Commit Graph

21 Commits

Author SHA1 Message Date
renovate[bot]
aa8cbb9fa3 Update dependency typescript to v5.1.6 2023-06-29 08:24:30 +02:00
renovate[bot]
58b54333a5 Update dependency typescript to v5.1.5 2023-06-28 16:21:27 +02:00
renovate[bot]
17acd2437b Update dependency typescript to v5.1.3 2023-06-02 09:06:20 +02:00
Fabien "egg" O'Carroll
0abcba052c Used static created_at_ts to avoid flaky tests
closes https://github.com/TryGhost/Team/issues/3184
2023-05-12 08:13:51 -04:00
Fabien "egg" O'Carroll
b9565bc290 Migrated @tryghost/post-revisions to TypeScript!
This is an initial start to using TypeScript in our non-core Ghost packages.

- Adds a prepare script to build the project after installing deps
- Adds an initial tsconfig.json which is compatible with our node env
- Migrates all of the code to TypeScript, including tests
- Updates tests to use ts-node so that we don't need to compile the tests
- ts-node is installed at the top level because the env is weird with lerna and
  doesn't work otherwise
- Updates the yarn dev script to build the project with the --all and --revisions flag
2023-05-03 14:32:31 -04:00
Ronald Langeveld
6189040fc4
Added unpublished reason to post revisions (#16726)
closes https://github.com/TryGhost/Team/issues/3137

We have now included the ability to display an "Unpublished" tag for revisions that have been unpublished. The tag is only displayed when the revision's reason property is set to "unpublished". A new revision is triggered when a post is unpublished, regardless whether there's a change in the content.
2023-05-03 09:20:34 +02:00
Chris Raible
58efca6c04
Added background saves every 10 mins for post-revisions (#16703)
no issue
2023-04-21 16:04:54 +01:00
Fabien "egg" O'Carroll
5feedadc80 Wired up feature image alt and caption to DB and Admin
We no longer need a reference to the previous version, instead we can use the
latest revision, this makes it easier to compare "off table" data such as the
feature image caption stored in posts_meta.
2023-04-21 15:26:43 +01:00
Ronald Langeveld
f68936900c
Added post status saving (#16702)
no issue 

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at ebd1973</samp>

This pull request adds support for storing and tracking the status of
posts in revisions. It introduces a new `post_status` column and
property in the `post` and `PostRevision` models, and updates the
`PostRevisions.formatInput` method to handle it.
2023-04-21 15:17:25 +01:00
Chris Raible
3aec11328f
Populated reason field in post-revisions when revision is created (#16700)
no issue
2023-04-21 14:36:35 +01:00
Chris Raible
857a5ad004
Fixed FIFO for post revisions (#16696)
no issue

- with this change, the oldest revision will be deleted and the new
revision will be added if the limit is reached
2023-04-21 13:34:12 +01:00
Fabien 'egg' O'Carroll
169a56d1bb
Added feature_image to post_revisions (#16695)
This will allow us to store historical data for feature images so we can
diff and restore them
2023-04-21 12:02:04 +01:00
Chris Raible
06262ecf33
Added logic for saving revisions on explicit saves (#16688)
refs @TryGhost/Team#3076

- added `save_revision` option to edit post endpoint
- this change covers the following cases:
1. we will not save a `post_revision` on every background autosave that
occurs after 3 seconds of inactivity in the editor
2. we will save a `post_revision` when the user hits `cmd+s` in the
editor to explicitly save
3. we will save a `post_revision` when the user navigates away from the
editor (e.g. by clicking the 'Posts' breadcrumb in the editor)
4. we will save a `post_revision` when the user publishes a post
5. we will save a `post_revision` when a user updates an already
published post
2023-04-21 10:04:05 +01:00
Michael Barrett
78da6cf77d
Removed post revision author id on user deletion (#16670)
no issue

When a user is deleted any post revisions created by the user are set to
be owned by nobody (null) rather than deleting the post revisions
associated with the user
2023-04-19 14:00:45 +01:00
Michael Barrett
9911e6be78
Persisted post revision author and title (#16653)
no issue

Persisted post revision author and title
2023-04-18 14:15:26 +01:00
Fabien "egg" O'Carroll
b41897a2b4 Fixed unit tests 2023-04-17 16:52:51 +01:00
Fabien "egg" O'Carroll
ff082c1934 Fixed revision creation for new posts
We had incorrectly ported the existing functionality and started adding 2
revisions for each new post. This fixes the logic to only add 1.
2023-04-17 16:49:17 +01:00
Fabien "egg" O'Carroll
a507072eb8 Updated PostRevisions to accept html string
- We also fix the name of the feature flag
- We also correctly await the result of revision generation
- We pass the HTML string so we can potentially do an easier word count diff
2023-04-17 16:16:08 +01:00
Fabien "egg" O'Carroll
a62fe42933 Implemented initial PostRevisions class
This aims to implement the current strategy of revision generation so that we
can switch to it and start tweaking it whilst the flag is enabled
2023-04-17 14:47:27 +01:00
Fabien "egg" O'Carroll
f3a572a9d1 Fixed unit test coverage
For some reason blank files would fail unit test coverage
2023-04-17 11:23:52 +01:00
Fabien "egg" O'Carroll
12d0c3bf64 Added post-revisions package
This package will be used to contain the logic for determining when a
revisions should be generated for a post. It will be used by the Post
model during saving and will not handle the storage of revisions
2023-04-17 11:14:57 +01:00