refs https://github.com/TryGhost/Team/issues/2110
- dynamically defined properties on the config service did not have
autotracking set up properly if they were accessed in any way before the
property was defined, this caused problems in a number of areas because
we have both "unauthed" and "authed" sets of config and when not logged
in we had parts of the app checking for authed config properties that
don't exist until after sign-in and subsequent config re-fetch
- renamed `config` service to `configManager` and updated to only
contain methods for fetching config data
- added a `config` instance initializer that sets up a `TrackedObject`
instance with some custom properties/methods and registers it on
`config:main`
- uses application instance initializer rather than a standard
initializer because standard initializers are only called once when
setting up the test suite so we'd end up with config leaking across
tests
- added an `@inject` decorator that when used takes the property name
and injects whatever is registered at `${propertyName}:main`, this
allows us to use dependency injection for any object rather than just
services or controllers
- using `application.inject()` in the initializer was initially used but
that only works for objects that extend from `EmberObject`, the
injections weren't available in native-class glimmer components so this
decorator keeps the injection syntax consistent
- swapped all `@service config` uses to `@inject config`
no issue
The `config` 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 `config` service by grabbing the API response after fetching and using `Object.defineProperty()` to add native getters/setters that pass through to a tracked object holding the API response data. 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 `config.{attrName}` directly for getting/setting instead of `.get()` and `.set()`
- removed unnecessary async around `config.availableTimezones` which wasn't making any async calls
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
refs: https://github.com/TryGhost/Team/issues/1145
- this should allow us to remove the /products endpoint in v5
It avoids:
- `kg-product-card`, that really is meant to say product
- `product-cadence` on offers
Co-authored-by: Rishabh <zrishabhgarg@gmail.com>
no issue
We still had some old components and templates from the `members-email` settings that were only were used when the (now GA) `multipleNewsletters` flag was disabled. I’ve removed them and renamed all routes and components from `members-email` and `members-email-labs` to just `newsletters` because it was sometimes hard to understand if a given components was still used or not when fixing issues.
refs https://github.com/TryGhost/Toolbox/issues/308
- this endpoint is being switched to return a 204 with no body upon success
- if we don't change this code, the button will get stuck in a red Retry
state because it reads the `undefined` body and thinks it's an error
- this commit makes sure we return true if the POST is successful
refs https://github.com/TryGhost/Toolbox/issues/308
- we have a pattern of using plurals for endpoints but `email_preview`
was implemented without it
- in v5, we're fixing that so we need to update Admin to take that into
account
The segment select UI for restricting post access to specific tier also showed a member count for selected tiers, which was not needed as that count is dynamic and not relevant for setting access level.
refs https://github.com/TryGhost/Team/issues/1358
- added acceptance tests for members settings screen
- subscription access management
- default post access management
- free tier management
- fixed `enableLabsFlag()` test helper overwriting existing flag settings when enabling another one
- updated API mocks and fixtures
- matched product fixtures to default tiers-enabled products
- updated product API mocks to include benefit handling
no issue
- since `ember-concurrency@2.0` it's possible to use the standard imports as decorators removing the need for the extra `ember-concurrency-decorators` dependency and imports
refs https://github.com/TryGhost/Team/issues/1071
Default content visibility for specific tiers is now stored across 2 settings - `tiers` on `default_content_visibility` and list of tier ids on `default_content_visibility_tiers` setting, which is consistent with pattern of storing visibility on posts. This change -
- updates visibility filter UI for default content visibility segment select
- cleans up common visibility segment select component to handle ids directly instead of nql segments
- updates setting model
no issue
- This will help with the octane migration and you can still run the lint rules even when they are todos. (Checkout the docs at 158b119667/docs/todos.md) The good news is any new code will be checked against the recommended config.
- I fixed all the auto fixable things we could get in this PR as well
no issue
- ran [ember-native-class-codemod](https://github.com/ember-codemods/ember-native-class-codemod) to convert the majority of remaining EmberObject based controllers and components to native class syntax using the `@classic` decorator
- skipped older style modal components (`components/modal-*.js`) due to observed incompatibilities in some cases
refs TryGhost/Team#1071
Specific tier visibility for a post was previously stored in `visibility` column directly, which had a limitation of 50 charts. Going forward, for the specific tiers visibility of post/page, we use `tiers` array in API that contains list of tiers with access for post. This change -
- replaces `filter` type to `tiers` for visibility
- adds new visibility filter segment component in post settings menu which stores array of tiers instead of nql string for visibility
- updates serializer and model for post/page
- updates tests
refs https://github.com/TryGhost/Team/issues/559
refs https://github.com/TryGhost/Team/issues/1277
- switched modal implementation to the newer promise-modal style
- added `<GhEmailPreviewLink>` component that renders a link that when clicked opens the modal
- removes the need for templates/controllers to manually handle modal opening/closing and to pass actions down from parents
- updated all places we were triggering an email preview modal to use `<GhEmailPreviewLink>`
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()`
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)
refs https://github.com/TryGhost/Team/issues/840
We wanted to switch to a settings menu that stays open to the right of the editor rather than a popover that blocks all other interaction with the post to solve two use-cases:
1. when editing it's fairly common to select some text from the post contents when setting excerpt and meta data text, with the previous design not letting you scroll or select whilst the menu got in the way of that
2. having the menu open with meta data visible before publishing can help you see everything is set as you want and help you feel confident when publishing/sending content
---
- removed `psmRedesign` labs flag
- swapped labs component/css for main component and deleted labs component
- cleaned up now-unused `ui.showSettingsMenu` property and related actions/classes
no refs
Fixes a small bug in email retry logic meant we never timeout on polling for email retry while listening for the email status to see if it failed or submitted.
closes https://github.com/TryGhost/Ghost/issues/12110
- adds `{{gh-pluralize}}` helper that wraps the `{{pluralize}}` helper from `ember-inflector` but formats the number using our `{{format-number}}` helper
- updates all uses of `{{pluralize}}` to `{{gh-pluralize}}`
refs https://github.com/TryGhost/Ghost/issues/11971
- Newsletter preview email request has been using hardcoded fixed error message
- Reads custom error message from server's API response to show when available
refs https://github.com/TryGhost/Ghost/issues/11971
- Updates error messages incorrectly pointing to invalid mailgun config to show more generic error
- Needs to be updated to point to correct error message in future
no issue
Keeps component JS backing files and template files in the same directory which avoids hunting across directories when working with components. Also lets you see all components when looking at one directory, whereas previously template-only or js-only components may not have been obvious without looking at both directories.
- ran [codemod](https://github.com/ember-codemods/ember-component-template-colocation-migrator/) for app-level components
- manually moved in-repo-addon component templates in `lib/koenig-editor`
- removed all explicit `layout` imports as JS/template associations are now made at build-time removing the need for them
- updated `.embercli` to default to new flat component structure
no issue
- refactored `renderEmailPreview` into separate fetch and render functions
- grab email info from an existing email resource if it exists on the post rather than fetching a preview
- added "View email" button the the email-sent state of the newsletter settings PSM section
no issue
- removed unnecessary scratch value handling for a non-model property
- use [`oneWay`](https://api.emberjs.com/ember/release/functions/@ember%2Fobject%2Fcomputed/oneWay) to bind the logged in user's email address to the `testEmailAddress` property on the component - this allows for the default value to always be the logged in users email but changing the property value only changes the value on the component, not upstream on the user model
- use default two-way binding of the `<Input>` helper to avoid unnecessary boilerplate
- removed unnecessary usage of the `truncate` helper for the placeholder