Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added custom excerpt to post revisions #20323

Merged
merged 8 commits into from
Jun 5, 2024

Conversation

kevinansfield
Copy link
Member

@kevinansfield kevinansfield commented Jun 4, 2024

closes https://linear.app/tryghost/issue/MOM-170

When the subtitle field is included in the editor it creates a disconnect with post revisions if the underlying custom excerpt data is not included so we'd like to both preview and restore the subtitle when the in-editor subtitle field is enabled.

  • added post_revisions.custom_excerpt column to schema
  • added migration to add post_revisions.custom_excerpt to existing databases
  • added migration to populate post_revisions.custom_excerpt with the current post.custom_excerpt value from the associated record
    • ensures no data is inadvertently lost when restoring an old version
    • using current data matches what would have happened previously where custom_excerpt was never overwritten when restoring an old version
  • updated post revisions handling to accept the custom_excerpt field
  • updated Admin's revision preview and restoration to display and set the custom_excerpt field

@github-actions github-actions bot added the migration [pull request] Includes migration for review label Jun 4, 2024
Copy link
Contributor

github-actions bot commented Jun 4, 2024

It looks like this PR contains a migration 👀
Here's the checklist for reviewing migrations:

General requirements

  • Satisfies idempotency requirement (both up() and down())
  • Does not reference models
  • Filename is in the correct format (and correctly ordered)
  • Targets the next minor version
  • All code paths have appropriate log messages
  • Uses the correct utils
  • Contains a minimal changeset
  • Does not mix DDL/DML operations

Schema changes

  • Both schema change and related migration have been implemented
  • For index changes: has been performance tested for large tables
  • For new tables/columns: fields use the appropriate predefined field lengths
  • For new tables/columns: field names follow the appropriate conventions
  • Does not drop a non-alpha table outside of a major version

Data changes

  • Mass updates/inserts are batched appropriately
  • Does not loop over large tables/datasets
  • Defends against missing or invalid data
  • For settings updates: follows the appropriate guidelines

@github-actions github-actions bot added the affects:admin Anything relating to Ghost Admin label Jun 4, 2024
Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.35%. Comparing base (9bf5a61) to head (4dcd3e3).
Report is 154 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20323      +/-   ##
==========================================
+ Coverage   73.28%   73.35%   +0.06%     
==========================================
  Files        1264     1267       +3     
  Lines       74317    74735     +418     
  Branches     9886     9966      +80     
==========================================
+ Hits        54462    54820     +358     
- Misses      19056    19108      +52     
- Partials      799      807       +8     
Flag Coverage Δ
admin-tests 42.53% <100.00%> (+0.37%) ⬆️
e2e-tests 81.85% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

- added `post_revisions.custom_excerpt` column to schema
- added migration to add `post_revisions.custom_excerpt` to existing databases
- added migration to populate `post_revisions.custom_excerpt` with the current `post.custom_excerpt` value from the associated record
  - ensures no data is inadvertently lost when restoring an old version
  - using current data matches what would have happened previously where custom_excerpt was never overwritten when restoring an old version
- camelCase->snake_case is already handled
- `postIdLocal` does not appear to be used anywhere
@kevinansfield kevinansfield marked this pull request as ready for review June 5, 2024 08:56
@kevinansfield kevinansfield changed the title Added custom excerpt (subtitle) to post revisions Added custom excerpt to post revisions Jun 5, 2024
@kevinansfield kevinansfield merged commit b447a26 into TryGhost:main Jun 5, 2024
24 checks passed
@kevinansfield kevinansfield deleted the excerpt-revisions branch June 5, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:admin Anything relating to Ghost Admin migration [pull request] Includes migration for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants