no issue
The `settings` service has been a source of confusion when writing with modern Ember patterns because it's use of the deprecated `ProxyMixin` forced all property access/setting to go via `.get()` and `.set()` whereas the rest of the system has mostly (there are a few other uses of ProxyObjects remaining) eliminated the use of the non-native get/set methods.
- removed use of `ProxyMixin` in the `settings` service by grabbing the attributes off the setting model after fetching and using `Object.defineProperty()` to add native getters/setters that pass through to the model's getters/setters. Ember's autotracking automatically works across the native getters/setters so we can then use the service as if it was any other native object
- updated all code to use `settings.{attrName}` directly for getting/setting instead of `.get()` and `.set()`
- removed use of observer in the `customViews` service because it was being set up before the native properties had been added on the settings service meaning autotracking wasn't able to set up properly
no issue
- Added Ghost Explore screen behind alpha flag
- Moved existing /explore route to /explore/connect which we'll redirect to for outside requests
- Added iframe communication with Ghost Explore App
no issue
Since `ember-moment@10.0` it's not been necessary to use the `ember-cli-moment-shim` package, with `moment` instead being usable directly via `ember-auto-import`. Getting rid of the shim package is necessary for compatibility with `embroider`, Ember's new build tooling.
- dropped `ember-cli-moment-shim` dependency
- added `moment-timezone` dependency and updated all imports to reflect the different package
- worked around `ember-power-calendar` having `ember-cli-moment-shim` as a sub-dependency
- added empty in-repo-addon `ember-power-calendar-moment` to avoid `ember-power-calendar` complaining about a missing package
- added `ember-power-calendar-utils` in-repo-addon that is a copy of `ember-power-calendar-moment` but without the build-time renaming of the tree for better compatibility with embroider
no issue
- Added `/explore` route which requires min. Admin and is behind a feature flag
- Fetches Admin API key and ID to create a token and return back to Ghost Explore with the correct query params
- Fullscreen UI
refs https://github.com/TryGhost/Team/issues/1613
We use `notifications.showAPIError()` in many of our try/catch routines but those can also pick up standard JS errors which can result in ugly and useless messages showing in alerts.
- added a list of known built-in JS error type names to check against and a generic error message to be used in place of ones we know shouldn't be displayed
- in `showAPIError(obj)` check `obj.name` against the known list and swap the message for a generic one
- only the message is swapped, we still log the full/original error to Sentry
- in `handleNotification(msg)` which is the final method used when displaying any alert/notification, extract all words in the supplied message and check that against the known list and swap the message on a match. This handles situations where the API might give us a raw JS error message in the message string
refs e021843e3f
- fixed closing of alerts due to missing `.args` after migrating to glimmer syntax
- updated related tests for glimmer component syntax
refs: TryGhost/Team#1625
- we want to remove backwards compatibility code for slack being a single setting
Co-authored-by: Rishabh <zrishabhgarg@gmail.com>
no issue
- members having multiple subscriptions is not really expected but if it does happen then the most recently updated subscription is most likely to be the one that we're interested in showing the details of in the members table
- added `{{most-recently-updated arr}}` helper+function that will return the item in the array argument with the most recent "updated at" value
- uses `updatedAtUTC` or `updatedAt` or `updated_at` values so it will work against any of our models or un-transformed API response objects
- updated `<GhMembersListItemColumn>` to use a `mostRecentSubscription` getter when showing subscription data rather than assuming the first object in the subscriptions array should be displayed
no issue
- part of ember upgrades
- removed all unnecessary usage of `.get`
- cleaned up imports where we had imports from the same module across multiple lines
- standardized on importing specific computed helpers rather than using `computed.foo`
- switched tests from using `wait()` to `settled()`
closes https://github.com/TryGhost/Team/issues/950
- fixes the mrr value/chart on dashboard when a site has no new mrr events in more than 30 days shown as 0
- adds tests to cover more mrr event scenarios
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
Having `session.user` return a promise made dealing with it in components difficult because you always had to remember it returned a promise rather than a model and had to handle the async behaviour. It also meant that you couldn't use any current user properties directly inside getters which made refactors to Glimmer/Octane idioms harder to reason about.
`session.user` was a cached computed property so it really made no sense for it to be a promise - it was loaded on first access and then always returned instantly but with a fulfilled promise rather than the underlying model.
Refactoring to a synchronous property that is loaded as part of the authentication flows (we load the current user to check that we're logged in - we may as well make use of that!) means one less thing to be aware of/remember and provides a nicer migration process to Glimmer components. As part of the refactor, the auth flows and pre-load of required data across other services was also simplified to make it easier to find and follow.
- refactored app setup and `session.user`
- added `session.populateUser()` that fetches a user model from the current user endpoint and sets it on `session.user`
- removed knowledge of app setup from the `cookie` authenticator and moved it into = `session.postAuthPreparation()`, this means we have the same post-authentication setup no matter which authenticator is used so we have more consistent behaviour in tests which don't use the `cookie` authenticator
- switched `session` service to native class syntax to get the expected `super()` behaviour
- updated `handleAuthentication()` so it populate's `session.user` and performs post-auth setup before transitioning (handles sign-in after app load)
- updated `application` route to remove duplicated knowledge of app preload behaviour that now lives in `session.postAuthPreparation()` (handles already-authed app load)
- removed out-of-date attempt at pre-loading data from setup controller as that's now handled automatically via `session.handleAuthentication`
- updated app code to not treat `session.user` as a promise
- predominant usage was router `beforeModel` hooks that transitioned users without valid permissions, this sets us up for an easier removal of the `current-user-settings` mixin in the future
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
refs https://github.com/TryGhost/Team/issues/587
- This is first pass on the frontend limit-service integration. Max count queries are substituted with HTTP requests to mimick backend checks. Note, they are not meant to substitute backend checks only to suplment them.
refs https://github.com/TryGhost/Team/issues/587
refs e30b9735fa
- It was not possible to invite a new Contributor to a site that has reached its limit
- This fix divides the resend invite action into two separate steps: 1. Deleting existing invite 2. Creating a new one for the same data
- It was hitting the limit because the permissions were correctly checking for "add" action being executed when the limit of invites/staff users was already used up. By removing existing invite we mimic the behavior the server would do for us anyway (2111992dd4/core/server/services/invites/invites.js (L18-L22))
Co-authored-by: Rish <zrishabhgarg@gmail.com>
no refs
MRR start date value for charts was being calculated with start value as 0, assuming we have the data for first date in our range to use as start value. Since the events data returned only has data on dates where any MRR event happened, in case the first date in our range didn't have any. data we started from 0 instead of value on previous date. This fix
- updates calculation to pick the start value for chart based on value on last date in our range(30 days)
- adds unit tests for stats
refs 10b48b1d6d
refs 1531712d92
- the tour feature is no longer used so all associated code can be removed
- removes `liquid-tether` dependency as it was only used by the tour throbbers/popovers
refs https://github.com/TryGhost/Ghost/pull/12632
- The `unsplash` setting has been migrated to a new format - plain boolean value. This is why it's no longer needed to do any serialization dances
refs https://github.com/TryGhost/Team/issues/221
- we're getting ready for the 4.0 API version so we should be using canary to fully test the changes
- changed from `v3` to `canary` in `utils/ghost-paths.js`
- updated mirage and tests to use `ghostPaths` util so we only need to change the version in one place in the future
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/Ghost/pull/11409
- Added a new UI for a second set of navigation links
- This should support most concepts of nav, e.g. left and right, or header and footer
- This PR mostly updates the design and nav components to cope with a second set of nav
no issue
- We have a need to create a member manually, this changeset solves this problem.
- Added new member button to the member's screen
- Needed to be able to perform add member action
- Fixed inconsistent `createAt` naming. All models use consistent `createdAtUTC`, fixed it up so that members model follows the same pattern. If we want to change this pattern should probably happen for all models at once
- Fixed member avatar when creating a new member. If the values are completely empty the screen ends up being filled with empty space. Added some dummy initials which are recalculated once the member enters the name or an email
- Refactored DS naming for consistency. Nowhere else in the codebase 'DS' name is ever used, made this consistent
- Added missing validations in members form
- Simplified if conditions in the member list template. When using the if/esle statements unnecessary new-line symbols were inserted which made it hard to test. Also by using computed property view is much cleaner
- Updated member's model default value for `subscribed` to "true". It is turned on by default in the model layer on the backend (ref: https://github.com/TryGhost/Ghost/blob/3.1.0/core/server/data/schema/schema.js#L330), this behavior is intended and should be the same on the frontend
closes https://github.com/TryGhost/Ghost/issues/10995
- when first loading the site preview, if private mode is enabled submit the login form in the background to get the cookie before loading the iframe
- refactors post-authentication preloading to ensure it occurs before post-authentication route hooks are called
- adds `showSuccess` attribute to `<GhTaskButton>` so that when set to `false` it can stay in the running state after "success" to avoid state change flashes whilst waiting for a transition
no issue
- `app/helpers/gh-format-html` is duplicated in `lib/koenig-editor/addon/helpers/sanitize-html` and is not used anywhere else
- `app/helpers/gh-path` is not used anywhere - the API should be returning absolute URLs everywhere so path generation is no longer as necessary within templates
- `app/helpers/is-equal` replaced with `{{eq}}` from `ember-truth-helpers`
- `app/helpers/is-not` replaced with `{{not}}` from `ember-truth-helpers`
- `app/utils/isFinite` is not used anywhere
- `app/utils/titleize` is not used anywhere
no issue
- removes now-unneeded `adapter-error` override helper
- comments out the `gh-post-settings-menu` unit tests because the top-level `describe.skip` was causing all further unit tests to be skipped
closes https://github.com/TryGhost/Ghost/issues/10593
- adds a "Canonical URL" field to the Meta Data section of the Post Settings Menu
- adds validation for canonical url being a valid absolute or relative URL
no issue
- added `page` model
- removed `page` param from Post model
- added pages screen with associated links
- added `:type` param to editor screens to work with the right models
- removed post<->page toggle and associated tour item
closes https://github.com/tryghost/ghost/issues/10088
* added `updateDocumentTitle` action to base route and replace usage of `.send('collectTitleTokens, [])`
* added `.titleToken()` method to editor route to add post title to document title
* called `.send('updateDocumentTitle')` after saving post title in editor controller to keep document title in sync
* updated editor controller test for latest ember-mocha and ember-test-helpers
no issue
- upgrade to latest `ember-source` and related dependencies including `ember-cli`
- upgrade to latest `ember-mocha` and modern ember testing setup
- https://github.com/emberjs/rfcs/blob/master/text/0268-acceptance-testing-refactor.md
- switch from using global acceptance test helpers and `native-dom-helpers` to using the new `ember-test-helpers` methods
- use [`chai-dom`](https://github.com/nathanboktae/chai-dom) assertions where in some places (still a lot of places in the tests that could use these)
- pin `ember-in-viewport` to 3.0.x to work around incompatibilities between different versions used in `ember-light-table`, `ember-infinity`, and `ember-sticky-element`
- incompatibilities manifested as "Invalid value used as weak map key" errors thrown when using `ember-light-table` (subscribers screen)
- pin `ember-power-datepicker` to unreleased version that contains a move from global acceptance test helpers to modern test helpers