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
This reverts commit 0cf2fc9c24.
Hiding the launch wizard when there are existing prices causes an annoying flicker on the dashboard everytime we reload the page or navigate away. Instead of handling this client side, we'll push up the logic to hide the wizard on server.
refs https://github.com/TryGhost/Team/issues/644
In case the prices are already set for the default product, its confusing to have the launch wizard show the price setup again. We remove the wizard completely if the prices are already created for the default product.
no issue
- tour items in general are being removed
- preparation for full removal of all tour-related code (to be done in following commit to allow future revert without merge errors through template divergence)
refs b4e750466d
- liquid-wormhole was throwing an error with the previous approach because it appeared to be trying to run it's destroy routines after the element had already been removed or hadn't been rendered yet
refs 6a14087ccc
- `super()` is needed in `beforeModel()` hook so that the AuthenticatedRoute redirect can occur
- launch wizard acceptance test needs to use an Owner user because Admins don't have access
refs https://github.com/TryGhost/Team/issues/460
- member payment settings are only changeable by owners which would leave the wizard being a single step
- wizard is designed to be used as one of the first things after initial site setup which will be completed as the owner user
refs https://github.com/TryGhost/Team/issues/450
- swapped individual step routes for single launch route and query params to allow for easier management of step content and preview via components
- defined all wizard steps inside of launch controller
- updated templates to use a fixed preview across all steps
refs https://github.com/TryGhost/Team/issues/450
Initial prototype of new launch-site wizard, meant to speed up the setup of a members site with the following steps:
1. Customise design
2. Connect Stripe
3. Set subscription pricing
- added wizard link to dashboard screen
- added `/launch/*` screens representing the wizard steps
- duplicated and refactored relevant general and members setting code and templates into each step
refs https://github.com/TryGhost/Team/issues/450
- adds `launch/*` routes corresponding to launch wizard steps
- sets up navigation between each wizard step
- adds components for each `launch/*` step to contain step-related functionality and facilitate later refactoring to a generalised wizard component
- adds link to the launch wizard from the dashboard screen