refs https://github.com/TryGhost/Team/issues/609
There's a 3 second timeout before a background save is triggered after the last edit, if the preview modal is opened in that timeframe it would show outdated content.
- added a task that is triggered when the preview modal is opened
- if a save task is already running it will wait for it to finish
- otherwise if the post is a draft and the editor has dirty attributes it will trigger a save
- modal shows a loading spinner whilst waiting for the save to finish so the preview contents always match the latest editor changes
refs 89a6bc683b
- `options` did not have a default value and it's always passed in. Added a default value of an empty object so we're not tripped up with null/undefined
closes https://github.com/TryGhost/Team/issues/1151
The publish-type state was being set directly on the model in the publish menu rather than being internal to the menu until publishing. A previous attempt had been made to fix that but it wasn't complete and resulted in the menu showing that it would "Publish" after setting it and closing/re-opening when in fact it would "Publish and send".
- moved all state for the distribution type and email settings to be stored in the `<PublishMenu>` component rather than split across the the component and model
- when saving a post from the publish menu, we now pass `emailOnly` as an option to the editor's save task the same as `sendEmailWhenPublished` (corresponding to the `email_recipient_filter` query param) so that we're back to one place controlling email behaviour for a post
- when `emailOnly` is passed as an option to the editor save task it will set the property on the model before saving and reset it back if the save fails. That way the email-only flag behaves as close to the "send when published" flag as possible without it also being sent as a query param.
refs https://github.com/TryGhost/Team/issues/559
- moved the modal component class, template, and sub-components into a `components/modals/` directory to keep the top-level dir cleaner
- migrated component class to full glimmer syntax
refs https://github.com/TryGhost/Team/issues/559
- moved the modal component class and template into a `components/modals/` directory to keep the top-level dir cleaner
- migrated component class to glimmer syntax
- moved route transition behaviour directly into the class to avoid weird route-action indirection
refs https://github.com/TryGhost/Team/issues/559
We want to get rid of our existing modals implementation because it doesn't play well with Glimmer compoments and the animation library it uses is now unmaintained and blocking our Ember.js upgrades.
- installed addon using customised fork
- fork allows passthrough of `allowOutsideClick` to `focus-trap` so we can allow clicks on dropdowns and other wormholed content inside of a modal
- extended the `modals` service locally so we can customise click-outside-to-close behaviour and tie in with our `dropdowns` service
- set up styles in `modals-new.css`, mostly copied from `modals.css` with a few specific overrides
- once all modals are converted we can drop the old `modals.css` and rename `modals-new.css`
refs https://github.com/TryGhost/Team/issues/954
- When an email-only post with a "sent" status was edited, it's status changed to "draft", which is an incorrect behavior. This change is causing the "sent" status to persist and removes the transition error.
refs https://github.com/TryGhost/Team/issues/973
- added `@showCreate` option to `<GhInputWithSelect>` that enables the create option without having to pass a function in `@showCreateWhen`
- fixed autofocus not focusing input element in `<GhInputWithSelect>` when `autofocus="true"` isn't enough by itself
- updated `selectOrCreate` in `<GhInputWithSelect>` to trigger `onChange` if it's passed in rather than `onInput`
- swapped input in labs snippet input to `<GhInputWithSelect>`
- added actions for updating a snippet when an existing snippet is selected
- added action to editor control for saving an updated snippet
refs https://github.com/TryGhost/Team/issues/954
- The transition values wever missing for new "sent" email status and caused a 500 error to be displayed even though it had nothing to do with server errors
- There will be more tweaks to this in future iterations, this is a stop gap solution to have a working UI
closes https://github.com/TryGhost/Team/issues/865
Ghost now returns a forbidden error rather than an unauthorized error when saving whilst logged out so the session invalidation was not being triggered.
- added forbidden check to ajax service to trigger session invalidation
- added automatic retry of save in editor when re-authenticating
- fixed re-population of user and proxy services when re-authenticating, it's not needed at that point because nothing has been cleared
issue https://github.com/TryGhost/Team/issues/857
- The goal is to avoid testing for the owner role only is cases where we should be testing for the owner or admin role
- `isOwner` => `isOwnerOnly`
- `isAdmin` => `isAdminOnly`
- `isOwnerOrAdmin` => `isAdmin` (concerns now both Owner and Admins)
no issue
- there can be cases where the connection fails but Ctrl/Cmd+S won't work as a direct retry (eg, publish fails so the status reverts, in that case Cmd+S would save a draft rather than re-attempt a publish)
- switched to a neutral "try again" message
closes https://github.com/TryGhost/Team/issues/837
We previously added automatic retries to the editor controller for post saves; reviewing the resulting logs in Sentry we can see this stopped the "Server unreachable" error alerts showing to users because the requests typically succeeded on the first retry that was made 5 seconds later. However the problem is not limited to post saves and we can see other requests hitting the same issue, including when working in the editor such as adding embed cards, uploading images, or fetching member counts before publishing.
All of the API network requests we make in Admin run through an `ajax` service that makes and handles the request/response. By moving the retry logic for specific errors out of the editor controller and into the ajax service we can make temporary connection handling more graceful across the app.
- move retry behaviour from the editor controller to the `ajax` service so we can retry any request rather than just post save requests
- speed up retries so we reconnect as soon as possible
- first retry at 500ms, then every 1000ms (previous was every 5s which meant overly long waits)
- reduce total retry time from >30s to 15s
- improve reporting to Sentry
- report when a retry was required
- report when a retry failed
- include the total time taken for both success and failure reports
- include the `server` header value from requests to distinguish between CDNs
- include type of error so we can distinguish "server unreachable" from "maintenance" retries
refs a6c6def7e1
- we weren't checking if an error was a validation error by examining the number of errors on the post model, this meant we weren't falling through to the generic error handling/display logic that shows an alert for validation errors when a save isn't a background/silent save
no issue
- when Ghost is in maintenance mode after an upgrade we know it will come back shortly so automatically retrying the save in the same way we do for "server unreachable" errors provides a smoother experience compared to halting and showing a red alert bar
no issue
- post status was not being reset after certain types of failure to publish/unpublish/schedule which meant that the editor could be left in an odd in-between state where the displayed status did not reflect reality
- fixed "saving/publish/schedule failed:" wording in error message when a server unreachable error was detected, the "saving/publish/schedule" did not reflect the actual status change because we were passing through only the current status rather than previous+new status'
no issue
- if a ServerUnreachable error is triggered by a non-background-save then we'd show the expected custom alert and then immediately overwrite it because `savePost`'s catch was not expecting an `undefined` error
refs https://github.com/TryGhost/Team/issues/788
- automatically retry any failed save attempts every 5 seconds for up to 30 seconds
- only show error bar after when we completely give up
- clear error bar if a later save is successful
- update error message to specify there's a connection problem and to retry with Cmd+S
- notify Sentry of a successful save after an initial failure including the number of attempts that were made and the total time for save to succeed in seconds
no issue
- helps indicate that you're dealing with an ember-concurrency task object rather than a function/action so you know to use `perform` and that you have access to derived state
refs https://github.com/TryGhost/Team/issues/786
Enabled through labs `psmRedesign` flag, rough implementation to help design direction.
- fixed rather than popover when opened by putting editor and sidebar inside a flex container
- settings toggle fixed in top right rather than separate close button
refs https://github.com/TryGhost/Team/issues/771
- added `<GhEditorFeatureImage>` for more flexibility than offered by `<GhImageUploaderWithPreview>`
- updated to more closely match intended designs
- removed alt/caption support from `<GhImageUploaderWithPreview>` as it's no longer used
- fixed upload/delete/upload not working due to file input references getting out of sync
refs https://github.com/TryGhost/Team/issues/707
Placing focus in the title aligns better with typical editorial process.
- switched `autofocus` attribute from body to title for new posts
- added a default value to the `mobiledoc` attr on the Post model, without it the autosave when moving from title to editor creates a forced re-render and clears the focus whilst you're typing
closes https://github.com/TryGhost/Team/issues/776
Since switching to using a real NQL filter in the `posts.email_recipient_filter` field where we used to show `free members`, `paid members`, or `all members` we were showing `status:free`, `status:-free`, and `status:free,status:-free` respectively. If labels are used in a filter the text became even longer.
- added a `membersCountCache` service
- `.count(filter)` fetches a numeric count from the members API, if the filter has been counted in the last minute it returns the count directly from a cache instead to avoid hammering the members API when we show counts in multiple places across the UI
- `.countString(filter)` fetches a count but returns a humanized string with the logic extracted from what we displayed in the confirm email sending modal
- added a `<GhRecipientFilterCount @filter="" />` component that acts as a wrapper around the async count from `membersCountCache`
- updated confirm email send modal, plus save notification and editor status displays for scheduled posts to use the new service and component
refs https://github.com/TryGhost/Team/issues/771
- updated `<GhImageUploaderWithPreview>` to take an `@includeMetadata` argument that shows a basic html supporting caption field underneath (ready for toggle between caption/alt but not fully implemented)
- added feature image alt/caption properties to post model
- updated UI behind "featureImageMeta" labs flag
- added the feature image uploader to the top of `<GhKoenigEditor>` for display above the editor title
- removed feature image uploader from post settings menu
- added labs flag checkbox
no issue
- catch `undefined` error when saving posts in editor which is thrown by our validation system and handled elsewhere
- bumped `ember-power-select` and switched `ember-power-datepicker` to a github ref so dependency-update fixes are included (version not released yet, see https://github.com/cibernox/ember-power-datepicker/issues/61)
- added a resolution for `ember-basic-dropdown@3.0.16`, with the latest `3.0.17` nothing is shown for the publish/post-settings menus for the date picker dropdown
refs https://github.com/TryGhost/Team/issues/459
- post previews are now always accessible from the editor header so there's no need for a separate preview link that takes you out of the editor
refs https://github.com/TryGhost/Team/issues/459
- pass required properties+actions through editor->post preview modal->publish menu
- replace publish button placeholder with `<GhPublishMenu>`
- close modal when saving if not a silent save
no issue
Updated settings navigation to a completely redesigned flow for Ghost 4.0 🎉
Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
Co-authored-by: Fabien O'Carroll <fabien@allou.is>
Co-authored-by: Rish <zrishabhgarg@gmail.com>
refs https://github.com/TryGhost/Team/issues/451
Start of new post preview prototype.
- adds preview button next to publish button
- opens new combined preview modal with desktop/email/social tabs
- desktop preview shows front-end preview url in iframe
- email preview fetches preview data as per the older email preview modal
- social preview to come later
no issue
- snippets can only be created and deleted by owners/admins/editors
- added a property in the editor controller to determine if the logged in user has sufficient permissions, then only pass the appropriate save/delete snippet actions to the editor component if the check is passed
- updates koenig menus and toolbars to skip rendering of buttons if the associated action function is not available
no issue
- show a delete icon when a snippet is hovered in plus/slash menus
- show a confirmation dialog when the delete icon is clicked
- keep menus open whilst displaying the delete confirmation dialog
no issue
- all of our models which allow users to name something use `name` as the field descriptor rather than `title` so `snippet.title` was renamed for consistency
- also fixes typo in the plus-menu component that stopped clicking on snippets from working
closes https://github.com/TryGhost/Team/issues/411
- adds "Create snippet" icon to the editor toolbar
- uses the same link input component design for specifying snippet titles
- snippets are loaded in the background when the editor is accessed
- snippets are listed at the bottom of the card menus of the + and / menus
- clicking a snippet inserts the snippet's contents in place of the current blank section
closes https://github.com/TryGhost/Ghost/issues/12102
- The scheduled date was incorrectly shown as month number in the toast box after scheduling
- Updates to correctly show the selected date
no issue
- the post/page conditional was looking at the old `post.page` property rather than the `post.displayName` that was added when posts and pages became separate models
refs https://github.com/TryGhost/Ghost/issues/11965
- be more explicit about when the post will be published
- indicate if and to which type of members the post will be emailed
- improved description formatting by making sure pertinent pieces of information do not wrap