Commit Graph

9 Commits

Author SHA1 Message Date
Kevin Ansfield
daa36a91b1
Fixed infinite save loop due to missing post_revisions include on saves (#18597)
refs edcd6caf2b
refs 56f2832754

- although we added an include for `post_revisions` when fetching a post for editing we didn't have the same `include` param added to saves meaning our revisions list was wiped from the store on each update
- on leaving the editor we check the last post revision to see if anything has changed and we need to save again, but with it being wiped and not being re-populated on save it meant the check always failed leading to an infinite loop of saves
- updated the posts and pages adapters to use the full includes param on create/update requests so we don't lose what we're trying to compare against
2023-10-12 19:16:45 +00:00
Chris Raible
9ea4fbd7a7
Added feature to convert and open mobiledoc posts in the lexical editor (#17453)
refs TryGhost/Product#3638

- Added `convert_to_lexical` flag to the posts/pages edit endpoint
- Added 'convertToLexical' feature flag so we can enable/disable this
feature independently from the main lexical beta flag
- Modified admin posts/pages list to point to the lexical editor for
_all_ posts, regardless of mobiledoc vs lexical (if the flag is on)
- Added call to edit endpoint with `convert_to_lexical` in the lexical
editor admin route if the page/post is currently in mobiledoc and the
flag is enabled
2023-08-08 15:44:54 -07:00
Ronald Langeveld
77e3b3e947
🐛 Fixed page revision returning empty array on update and restore (#17042)
closes https://github.com/TryGhost/Team/issues/3491

- the `PostRevisionModel` had a `belongsTo` relation to Post which resulted in the Page model returning an empty array in the `post_revisions` property.
- Simply removing it fixed it. refs https://ghost.slack.com/archives/C02G9E68C/p1686912389383579?thread_ts=1686909240.034419&cid=C02G9E68C
2023-06-16 13:24:02 +02:00
Kevin Ansfield
ce461aef34 Fixed post/page API requests having incorrect ?include= params
refs 58b0a1b90d

- `buildQuery` in the post/page adapters was recently removed which meant it was falling back to the `EmbeddedRelationAdapter.buildQuery` method which uses the defined Ember Data relationships to build up an `?include=` param
- the Ember Data relationships are not fully in sync with the API because we don't have models for all of the members/tiers related relationships meaning we were adding a more restrictive `?include` parameter than what the API would use internally by default, breaking parts of the app that expected the default embedded relationships
2022-09-16 12:54:50 +01:00
Kevin Ansfield
58b0a1b90d Fixed post/page requests in Admin not including correct ?formats param
no issue

- `buildQuery` method in adapters is only used for store `.query()` calls so when saving the formats param wasn't being added meaning we were losing the `lexical` field in the API response
- switched to `buildURL` which is always used
2022-09-15 17:40:45 +01:00
Kevin Ansfield
a7c4991af5 Wired up lexical editor saving
no issue

- fixed API returning "Invalid mobiledoc structure" errors when `mobiledoc:null` is sent in the payload alongside `lexical: '{...}'`
- updated Admin's `posts` and `pages` adapters to always add `?formats=mobiledoc,lexical` because the API doesn't return `lexical` by default
- added `lexical` attribute to Admin's Post model
- updated `lexical-editor` controller and related components to work with `lexical` always being a JSON string rather than a parsed object
- updated `<KoenigLexicalEditor>` to pass through the lexical state string as initial state and wired up the `onChange` prop
2022-09-13 21:01:53 +01:00
Kevin Ansfield
034812ac02 Dropped use of @classic decorator in adapters
refs https://github.com/TryGhost/Ghost/issues/14101

- `@classic` decorator is not required on adapter classes
- small cleanup of Octane migration code
2022-09-02 19:14:40 +01:00
Gabriel Csapo
fdc24103cc [chore] runs native classes codemod for app/adapters (#2239)
no issue

* ran native classes codemod for app/adapters
* migrated slug-url mixin to a utility
2022-02-02 16:57:22 +00:00
Kevin Ansfield
a0a0c50ff5 Removed use of ?include=tags,authors,authors.roles query param on post/page requests
no issue
- Admin API v2 now includes tags and authors by default
2019-02-25 21:55:55 +07:00