Commit Graph

1728 Commits

Author SHA1 Message Date
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
Naz
c21f136834 Corrected announcement_visibility setting type
refs https://github.com/TryGhost/Ghost/pull/14264

- With a requirement change we need to transform `announcement_visibility` setting to be an "array" instead of a "string". Array structure will allow us to hold multiple filters at once giving more coverage to the audience targetting usecases.
- Example filter variations we'll support are:
[ ] Logged out visitors
[ ] Members
[ ] Free members
[ ] Paid members
2023-04-21 10:18:50 +02:00
Rishabh Garg
d3c6d8ad13
Added Pintura integration page in Admin (#16686)
refs https://github.com/TryGhost/Team/issues/3034

- adds new integration page for Pintura in Admin
- allows site owners to enable/disable the image editor integration
- allows self-hosters to upload the files for enabling Pintura image
editor

---------

Co-authored-by: Sodbileg Gansukh <sodbileg.gansukh@gmail.com>
2023-04-20 21:20:07 +05:30
Rishabh Garg
bd127eae6d
Added new settings for pintura editor integration (#16682)
refs https://github.com/TryGhost/Team/issues/3034

- adds 3 new settings for managing pintura image editor integration in
admin
- `pintura` setting controls the enabling of the feature
- `pintura_css_url` is used to store path to pintura css file uploaded
on integration page
- `pintura_js_url` is used to store path to pintura js file uploaded on
integration page
2023-04-20 19:19:56 +05:30
Ronald
71052cb33e Added postdiffing feature flag
closes https://github.com/TryGhost/Team/issues/3078

- added post diffing feature flag to isolate it from post history.
2023-04-20 14:15:59 +01:00
Elena Baidakova
09ead74f21 Bumped announcement-bar package
no issue
2023-04-20 16:44:35 +04:00
Elena Baidakova
bf6f697be4 Fixed announcement-bar package version
no issue
2023-04-20 14:32:20 +04:00
Elena Baidakova
4c4e5a9c95 Hide announcement bar script if announcement_content is empty
refs TryGhost/Team#3009
2023-04-20 14:05:37 +04:00
Elena Baidakova
725956bc8b Added script for announcement bar insertion
refs TryGhost/Team#3009
2023-04-20 14:05:37 +04:00
Sag
06610e150a Bumped lexical packages
no issue
2023-04-20 10:54:16 +01:00
Elena Baidakova
9c59fbfb52 Bumped Lexical packages
no issue
2023-04-20 10:58:09 +04:00
Fabien "egg" O'Carroll
ce3f2221a0 Removed bookshelf-relations config from PostRevision model
This was causing issues with saving posts when revisions did not have authors
and is not necessary for the functionality we desire.
2023-04-19 17:49:23 +01:00
Naz
de41b07228
Exposed announcement settings in Content API
refs https://github.com/TryGhost/Team/issues/3011

- Allows to read following settings fields:
  - announcement - alias to announcement_content
  - announcement_background
2023-04-19 16:01:50 +02:00
Naz
388a625f37
Added announcement_* fields to Settings Admin API
refs https://github.com/TryGhost/Team/issues/3011

- Allows to edit and read following settings fields:
  - announcement_content
  - announcement_background
  - announcement_visibility
2023-04-19 16:01:50 +02: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
naz
865df1e143
Added announcement fields to settings table (#16654)
refs https://github.com/TryGhost/Team/issues/3011

- This is a data structure needed to support Announcement Bar feature -
allows to create custom site-wide announcements tailored to the
audience.
- The `announcement_content` is meant to hold displayed HTML content of
the announcement and will be exposed through unauthenticated Content
Site API

- The `announcement_visibility` sets the target audience to display the
Announcement Bart to:
  - `public` - Everyone
  - `visitors` - Logged out visitors only
  - `members` - Members only
  - `paid` - Paid members only

- The `announcement_background` sets the CSS class that should be
applied to the Announcement Bar. and will be exposed through
unauthenticated Content Site API. Three styles are available:
  - `accent` - matches the color of the site accent
  - `dark` - dark style
  - `light` - light style
2023-04-19 14:25:25 +02:00
Naz
7969399cdf
Added ability to pass 'flags' field into new settings
refs 3b90b1f335
refs https://github.com/TryGhost/Team/issues/3011

- The "flags" property was missing from the allowed parameters in addSettings migrations utility method. Passing in "flags" is needed to complete a refed issue where we add a new "announcement" group of settings and two of these settings have a "PUBLIC" flag
2023-04-19 14:02:03 +02:00
Chris Raible
f95012066a
Added author details to post_revisions in posts endpoint (#16674)
no issue

- added full author object to the post_revisions array on the /posts endpoint
- to be used in the post history modal to display who authored each revision
2023-04-19 12:05:55 +01:00
Rishabh Garg
48030c3050
Added basic image editing alpha feature (#16669)
refs https://github.com/TryGhost/Team/issues/3034

- adds new alpha feature flag for image editing in Admin
- allows new config for Pintura files that enable the image editing in
Admin
- adds new ember component for triggering image editing for post feature
images

---------

Co-authored-by: Sodbileg Gansukh <sodbileg.gansukh@gmail.com>
2023-04-19 16:27:26 +05:30
Chris Raible
65cf3afe5b
Fixed maxlength for author_id in migration v5.45 (#16668)
no issue

- maxlength for author_id was errantly set to 2000 instead of 24
- migration was failing with:

ERROR Field length of `author_id` in `post_revisions` is too long!

Field length of `author_id` in `post_revisions` is too long!

"This usually happens if your database encoding is utf8mb4.\nAll unique
fields and indexes must be lower than 191 characters.\nPlease correct
your field length and reset your database with `yarn knex-migrator
reset`.\n" "Read more here:
https://github.com/TryGhost/knex-migrator/issues/51\n"
2023-04-18 16:46:46 +01:00
Aileen Nowak
540de8eafd Added oembed Admin API endpoint to allow list
no issue

- Some services require the `oembed` API endpoint to be reachable via Admin API
- Adding the endpoint to the allowed list resolves this
2023-04-18 15:38:36 +01:00
Chris Raible
0130c9f553
Renamed foreign key constraint in migration v5.45 (#16664)
- the autogenerated constraint name was too long for MySQL, yielding the
error below (although it seems to be fine for sqlite)
- this change adds an explicit, shorthand name for the constraint to
stay under the limit on MySQL8

Error: alter table `post_revisions` add constraint
`post_revisions_author_id_foreign` foreign key (`author_id`) references
`users` (`id`), algorithm=copy - Specified key was too long; max key
length is 3072 bytes
2023-04-18 15:02:13 +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
Sag
932bfef27a
Bumped Lexical packages (#16661)
no issue
2023-04-18 13:42:05 +01:00
Chris Raible
e7f9f7c101 Fixed post revisions not loading in modal-post-history 2023-04-18 12:19:31 +01:00
Chris Raible
37e13b9c90 Removed post_revisions from posts-public.js 2023-04-18 12:03:30 +01:00
Michael Barrett
75e6ce261c
Added author & title to post revisions (#16649)
no issue

Added `created_by` and `title` columns to `post_revisions` table
2023-04-18 11:47:57 +01:00
Chris Raible
af367a2a18
Added post_revisions as a default include for posts (#16660)
no issue

- post_revisions will now be included in any request to the /posts
endpoint
- updated admin models to include post_revisions
- post revisions can now be accessed in the modal-portal-history via
this.post.post_revisions
2023-04-18 11:12:35 +01:00
Elena Baidakova
b7f091f732 Updated lexical packages
no issue
2023-04-18 13:23:02 +04:00
Elena Baidakova
9380209670
Added announcementBar feature flag and announcement input demo (#16659)
refs TryGhost/Team#3008

---

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

This pull request adds a new experimental feature for displaying an
announcement bar at the top of the site. It introduces a new component
template and class for the announcement bar, a new feature flag and its
UI controls, and some CSS adjustments for the editor input and the
announcement bar.
2023-04-18 13:12:37 +04:00
Steve Larson
8a563910d3 updated lexical packages
no refs
2023-04-17 16:24:36 +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
e151b55461 Fixed name of @tryghost/post-revisions 2023-04-17 14:59:13 +01:00
Fabien "egg" O'Carroll
454dc7a876 Added @tryghost/post-revisions to package.json
This is necessary for our build tool to pick up and bundle the package.
2023-04-17 14:56:12 +01:00
Fabien "egg" O'Carroll
7d7e19449a Used new PostRevisions service for revision generation
This is behind the postHistory flag so that we leave alone the very import
revision generation code. The new package attempts to replicate the existing
strategy but gives us room to easily change it in future
2023-04-17 14:47:27 +01:00
Chris Raible
4c893e5a63
Added post_revisions to posts endpoint as an include option (#16648)
no issue

- with this change, you can access a post's lexical revisions via the
api (e.g. `/posts/:id/?include=post_revisions`)

> _We are the post revisions, we won't be erased_
> _We rise from the ashes of the mobiledoc waste_
> _We join the API response, we claim our rightful place_
> _We are the post revisions, we show the truth of your face_
2023-04-17 13:46:27 +01:00
Michael Barrett
8dff121f73
Added postHistory feature flag (#16645)
no issue

Added flag to enable / disable post history from within the editor
2023-04-17 11:08:47 +01:00
Elena Baidakova
7f184d2451
Added support for filtering snippets to mobiledoc/lexical (#16636)
refs TryGhost/Team#2904


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

This pull request adds support for multiple formats of snippet content,
especially the `lexical` format, to the Ghost CMS. It modifies the
snippets API, model, and test files to handle the format conversion,
filtering, and serialization of snippets.
2023-04-17 10:54:08 +04:00
Ghost CI
5d43101f40 v5.44.0 2023-04-14 16:00:41 +01:00
Simon Backx
d98f29c6aa Added cache invalidation to posts and pages bulk apis
refs https://github.com/TryGhost/Team/issues/2677
2023-04-14 12:25:24 +02:00
Simon Backx
854f616f70
Added bulk edit pages API and admin UI (#16633)
refs https://github.com/TryGhost/Team/issues/2677

- This extends the bulk editing UI to pages.
- New endpoints for editing pages in bulk
- Support for type in bulk edit UI
- Fixed empty messages for lists
- Minor bugfixes (e.g. save button when adding tags became red because
task didn't return true)

---

This pull request adds support for bulk editing and deleting of pages in
the admin UI and the API. It refactors the context menu component and
the list templates to handle different types of content (posts or pages)
dynamically. It also updates the selection list utility and the no posts
box component to work with the new feature. It modifies the `posts.js`
and `pages.js` API files and the corresponding input and output
serializers and routes.
2023-04-14 12:16:15 +02:00
Elena Baidakova
eaf6e3c7e5
Added lexical column to snippets table (#16632)
refs TryGhost/Team#2904

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

This pull request adds a new `lexical` column to the `snippets` table to
store lexical information for snippets. It includes a migration script,
a schema update, and a schema hash update.
2023-04-14 13:18:41 +04:00
Fabien 'egg' O'Carroll
82393fa99d
Added bulk tag addition to post context menu
refs https://github.com/TryGhost/Team/issues/2922

Add multiple tags to multiple posts at once.

---------

Co-authored-by: Simon Backx <simon@ghost.org>
2023-04-13 16:17:36 +02:00
Sag
1d19021606
Bumped Lexical packages (#16626)
no issue
2023-04-13 10:47:22 +02:00
Kevin Ansfield
b286faf011
Initial setup for Lexical multiplayer websockets service (#16611)
no issue

Rough prototype only, current limitations:
- **No persistence**. Docs are in-memory only, YJS state will be lost on server restart although it could be re-populated by clients if they reconnect without closing their local doc (needs testing/investigation)
- **No tie-in with saved lexical state**. Lexical state is updated in the post model via normal API requests from Admin which can mean the multiplayer doc and the saved lexical state become out of sync but there's no detection/indication of that state at present. Will also trigger the "someone else is editing" errors because multiplayer doesn't yet override the default post update collision detection
- **New posts don't start in multiplayer**. New posts don't have an ID and so can't have a respective YJS doc, after initial save we don't transition to multiplayer because the React component in Ember doesn't re-render on prop changes yet
- **No tests**. Experimental code just to get something working and help answer questions for what's next

Changes:
- added `lexicalMultiplayer` labs flag
- updated `<KoenigLexicalEditor>` to pass through the required `<KoenigComposer>` props for multiplayer when enabled
- added `lexical-multiplayer` service
  - `init()` called during boot, used to set up the `enable()` and `disable()` methods so the flag can be toggled without restarts
  - when enabled it adds `upgrade` request handling to the base Ghost server
    - returns 404 if the URL doesn't match `/ghost/api/admin/posts/multiplayer/*`
    - returns 401 if a valid session cookie is not present
    - if everything is good, hands off to code in `y-websocket.js` that handles YJS doc creation, awareness, keepalive, etc
    - uses doc names in the format `${post.id}/${docId}` where `docId` is `main` for the primary document and a GUID for any sub-documents like captions and nested editors in cards
- updated `SettingsBREADService` to check if the `labs` setting is changed, and enables/disables the `lexical-multiplayer` service as needed so the websockets server can be started and shutdown when toggling without requiring a restart
2023-04-12 20:24:02 +01:00
Ghost CI
eafbb2856c v5.43.0 2023-04-12 11:38:08 +01:00
Ghost CI
63c5a47c02 🎨 Updated Casper to v5.4.9 2023-04-12 11:38:08 +01:00
Simon Backx
ab1ca90779
Implemented bulk editing post access (#16617)
fixes https://github.com/TryGhost/Team/issues/2924

This change adds a new bulk edit action for posts to update their
visibility. It also implements a modal to change the post access level
for multiple posts at once using this new API.

It also fixes a pattern that was used when modifying the Ember models in
memory. They previously were marked as dirty, this is fixed now. So when
going to the editor after modifying posts, you won't get a confirmation
dialog any longer.
2023-04-12 11:58:46 +02:00
Ghost CI
8571011e7d Merged v5.42.3 into main 2023-04-12 04:38:27 +01:00
Ghost CI
e185ed8b68 v5.42.3 2023-04-12 04:38:23 +01:00