Ghost/ghost/admin/app/controllers
Kevin Ansfield c646e78fff Made session.user a synchronous property rather than a promise
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
2021-07-08 14:54:31 +01:00
..
editor 🎨 Updated admin area design and usability (#1232) 2019-06-18 11:47:20 +01:00
integration/webhooks Updated navigation (#1832) 2021-02-02 16:08:06 +00:00
integrations Added limit check before adding new integration (#1934) 2021-04-28 19:29:25 +12:00
members Added automatic filter of members list after CSV import 2020-07-23 14:15:07 +01:00
settings Made session.user a synchronous property rather than a promise 2021-07-08 14:54:31 +01:00
setup Made session.user a synchronous property rather than a promise 2021-07-08 14:54:31 +01:00
staff Added the "reset all passwords" user interface 2021-06-28 11:54:45 +02:00
about.js Switched About screen to use config service 2019-02-26 16:12:34 +07:00
application.js Made session.user a synchronous property rather than a promise 2021-07-08 14:54:31 +01:00
billing.js Added billing controller for explicitness 2020-04-22 16:44:34 +12:00
dashboard.js 🐛 Fixed default currency for MRR stats on dashboard 2021-06-24 14:51:39 +05:30
designsandbox.js Renamed design sandbox template 2021-02-05 14:00:51 +01:00
editor.js Removed potentially confusing Ctrl/Cmd+S wording in editor connection error 2021-07-05 17:15:01 +01:00
error.js Refactored usage of .get('property') with es5 getters 2019-03-06 13:54:14 +00:00
integration.js Switch deprecated htmlSafe imports from @ember/string to @ember/template 2021-05-12 12:33:40 +01:00
integrations.js Disabled zapier if custom integrations are disabled 2021-03-04 21:26:24 +00:00
launch.js Updated pricing setup on launch wizard 2021-05-20 17:01:12 +05:30
member.js Updated complimentary subscription assignment to member 2021-05-19 22:36:02 +05:30
members.js Added automatic CSV export when bulk deleting members 2021-04-08 16:06:00 +01:00
pages-loading.js 🎨 Updated admin area design and usability (#1232) 2019-06-18 11:47:20 +01:00
pages.js Added open rate order option to posts list 2020-12-04 10:30:03 +00:00
posts-loading.js Added access level filter to posts and pages lists in admin 2020-06-09 12:19:40 +01:00
posts.js Fixed open rate appearing twice in posts ordering dropdown 2020-12-10 15:14:13 +00:00
reset.js Refactored usage of .get('property') with es5 getters 2019-03-06 13:54:14 +00:00
settings.js Removed unused portal-settings modal code from settings screen 2021-05-19 18:32:37 +01:00
setup.js Fixed deprecated access of controller.{currentPath,currentRouteName} 2019-05-06 14:51:23 +01:00
signin.js Switch deprecated htmlSafe imports from @ember/string to @ember/template 2021-05-12 12:33:40 +01:00
signup.js Made session.user a synchronous property rather than a promise 2021-07-08 14:54:31 +01:00
site.js Added reset-to-homepage behaviour when clicking "view site" link 2019-03-21 17:55:58 +00:00
tag.js 🐛 Fixed tag metadata fields not being populated when editing in admin (#1714) 2020-09-28 16:20:53 +01:00
tags.js Cleaned up and re-organised tag and new tag routes/controllers 2019-12-09 17:44:16 +00:00