Commit Graph

752 Commits

Author SHA1 Message Date
James Morris 8820a76c71 Renamed Finishing Touches onboarding step to Done with other changes and styling tweaks
refs: https://github.com/TryGhost/Team/issues/1376

- renamed finishing touches file to done
- no last modal, just the done screen for first start
- added options for next steps
2022-03-02 12:46:15 +00:00
Rishabh Garg 5869553483
Added filter by tiers to members filter UI (#2274)
closes https://github.com/TryGhost/Team/issues/1029

- allows site owner to filter members on specific tier
- needs tiers beta flag enabled and site should have more than 1 paid tiers.
2022-02-28 16:08:44 +05:30
Kevin Ansfield b320ef1d73 Removed "Email" member filter options when email sending is disabled
no issue

- updated the selection of available filter properties to remove any with the "Email" group when the default email recipients setting is set to "disabled"
2022-02-24 14:52:01 +00:00
Kevin Ansfield 4b137105ba Removed "Subscription" member filter options when Stripe is not connected
no issue

- updated the filtering of available filter properties to remove any with the "Subscription" group when Stripe is not connected
2022-02-24 11:24:39 +00:00
Kevin Ansfield 29feb87f98 Updated label filtering test to check labels column is populated correctly
no issue

- updated assertions to check that labels are shown inside the labels column when filtering members list by label
- added a member serializer to mirage so that relationships are correctly expanded to full embedded records
2022-02-23 13:54:23 +00:00
Kevin Ansfield 1a011bb909 Added last seen at column to members list when filtered
closes https://github.com/TryGhost/Team/issues/1388

- added `lastSeenAtUTC` property to member model
- added `last_seen_at` filter column handling to `<GhMembersListItemColumn>`
  - uses same format as the "Created" column showing the date only and a "days ago" string
2022-02-22 17:13:32 +00:00
Kevin Ansfield b273391289 Added tests for filtered columns showing in members table
refs https://github.com/TryGhost/Team/issues/1388
refs https://github.com/TryGhost/Team/issues/1337

- when filtering the members table, extra columns are shown to make any filtered data visible but we didn't have any tests for the functionality
- updated the `filterColumnLabels` getter to return an object with the original filter type name and the display label so it's easier to use test selectors
2022-02-22 16:10:16 +00:00
Kevin Ansfield 57f17503b3 🐛 Fixed mismatched operator in member filters after changing filter type
closes https://github.com/TryGhost/Team/issues/1384

- when setting the filter type, change the filter's relation/operator to match the filter type's first operator so the filter string and the UI are in sync
2022-02-22 10:08:16 +00:00
Kevin Ansfield cd00b39071 Added "Last seen" members list filtering options
closes https://github.com/TryGhost/Team/issues/1307

- adds "Last seen more/less than x days ago" option to members filtering UI
- re-ordered a few related objects/arrays so they are consistent
2022-02-22 09:47:01 +00:00
Kevin Ansfield f4dce9f479 🐛 Fixed saving of custom integrations
closes https://github.com/TryGhost/Ghost/pull/14183
refs 41346a5167

- unskipped test for integration saving
- fixed missed rename from `save` to `saveTask`
- fixed `saveTask` throwing from a "handled" validation error
2022-02-21 17:54:47 +00:00
Kevin Ansfield b76e425b2a 🐛 Fixed "Enable email open-rate" toggle
closes https://github.com/TryGhost/Team/issues/1381
refs a488b93465

- when the email newsletter settings was refactored, the `emailTrackOpens: reads('settings.emailTrackOpens')` was removed as it's a confusing redirection but it's usage in the toggle action was missed
2022-02-21 14:31:36 +00:00
Kevin Ansfield ae504b3e89 Fixed linter error 2022-02-19 22:26:28 +00:00
Kevin Ansfield 729d0e9786 Fixed membership tests in CI
refs b58ec2a3cb

- blogUrl config was not set meaning the baseUrl handling in `<GhUrlInput>` picked up the current test URL which can change between test runs, especially when run in parallel using ember-exam
2022-02-19 22:20:33 +00:00
Kevin Ansfield b58ec2a3cb Added non-Stripe members setting screen acceptance tests
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
2022-02-18 22:36:01 +00:00
Kevin Ansfield 882f1556f5 🐛 Fixed Admin crash when member filters were focused+blurred without entering a filter value
closes https://github.com/TryGhost/Team/issues/1309
closes https://github.com/TryGhost/Team/issues/1336

- the error occurred because the `<Members::FilterValue>` component detaches it's value from the passed in value it was initialized with. Due to the detached handling, after changing the filter type away from the default label filter to a text input based filter, the internal value stayed as `[]` even though the filter type's value was changed. When the blur event was triggered in that state the internal `[]` value was used to update the filter resulting in an invalid filter string
  - added a quick-fix of assigning the input's value in the blur event handler meaning we get the expected `''` value
  - allows for passing tests to be created ready for a deeper fix/refactor later
- added `nql` dependency and used it in the `GET /members` API mock to match members against the filter param so behaviour matches the real API
  - tested increase in code size - dev build increased by ~180KB, no difference in prod
- added acceptance tests for all current filters and search
2022-02-15 21:38:57 +00:00
Kevin Ansfield 5895540c5b Fixed test-selector typo for members table
refs b76291ccb7 (commitcomment-66689174)

- fixed typo
- added check to base state test to confirm
2022-02-15 15:01:36 +00:00
Kevin Ansfield bd93f0db0b Removed unused `resolver` test helper
no issue

- hangover from older Ember versions
2022-02-15 15:01:36 +00:00
Kevin Ansfield 1571c70ad1 Removed unused `find*` test helpers 2022-02-15 15:01:36 +00:00
Kevin Ansfield 8e88d8451e Fixed linter error for unused variable 2022-02-15 13:31:17 +00:00
Kevin Ansfield 9c9b55c727 🐛 Fixed "Header two" formatting toolbar button not working
closes https://github.com/TryGhost/Ghost/issues/14146
refs https://github.com/TryGhost/Admin/pull/2251

- an action rename was missed when converting the toolbar component to native class syntax
- added test for the h3 toolbar button working
  - fixed `<KoenigEditor>` not assigning the test property that gives tests access to the underlying mobiledoc `editor` instance
2022-02-15 13:23:37 +00:00
Kevin Ansfield b76291ccb7 Added acceptance test for members search
refs https://github.com/TryGhost/Team/issues/1336
refs 343ad982ea

- adds basic search param handling to `GET /members` API mock
- adds acceptance tests for basic search behaviour
- contains regression check for search input not being visible when no members match
2022-02-14 16:23:57 +00:00
Kevin Ansfield 4eda1eac76
Disabled non-functional edit buttons in labels dropdown when importing members (#2258)
closes https://github.com/TryGhost/Team/issues/1320

- added `@allowEdit` argument to `<GhMemberLabelInput>` and changed the dropdown to only show the edit label when `@allowEdit` is truthy
- updated usage in the filter UI and members detail screens to allow editing
2022-02-11 15:20:28 +00:00
Kevin Ansfield d24b7fc971 🐛 Fixed labels not being selectable in members importer
refs https://github.com/TryGhost/Team/issues/1320

- added a tracked `labels` property in `<ModalImportMembers::CsvFileMapping>` and passed it through to `<GhMembersLabelInput>` so that it has a list of labels that can be added to
- fixed error from sorting labels if one doesn't have a name
- added acceptance test for selecting labels in the members import flow
2022-02-11 13:10:42 +00:00
Kevin Ansfield 7d8dcd2b9d Added basic happy path acceptance test for member csv upload
refs https://github.com/TryGhost/Team/issues/1320

- fixed event handling in `gh-file-input` for test-initiated uploads
- added `POST /members/upload/` API mock that emulates uploading a single member
  - it's enough for this particular test and can be expanded as needed
- added acceptance test that does a simple 1-member, no Stripe, CSV upload with no mapping changes
2022-02-11 11:07:13 +00:00
Kevin Ansfield 42839415dd Added acceptance test for members import modal display
refs https://github.com/TryGhost/Team/issues/1320

- start of acceptance tests ready for more detailed testing
- added ignore of `no-duplicate-landmark-elements` lint rule in import modal template
  - the rule was a false flag because the conditionals only allow one `<header>` element to be rendered at a time
2022-02-11 10:01:08 +00:00
Sanne de Vries 4ed18f01bb Fixed test 2022-02-09 10:56:21 +01:00
Kevin Ansfield 2e296efd3d Cleaned up members filter labs components
no issue

- the members filtering is out of labs, we don't need to keep the labs component naming around
- renamed `-labs` components/classes to non-labs naming, replacing old and unused non-labs components where necessary
2022-02-08 11:48:55 +00:00
Kevin Ansfield 793ccecf5b Changed firstStart flow to show a streamlined settings screen
closes https://github.com/TryGhost/Team/issues/1310

- added `/setup/finishing-touches` route
  - refreshes theme preview on access
  - uses existing setting form components to build a reduced settings menu
- updated `/?firstStart=true` handling to transition to `/setup/finishing-touches` instead of showing the get-started modal
- updated standard setup flow to show the get-started modal upon completion
  - `/?firstStart=true` flow for now will only be used when a theme has been chosen before site creation
2022-02-04 17:06:40 +00:00
Peter Zimon e782768a8c Fix tests 2022-02-02 10:57:34 +01:00
Kevin Ansfield 39a46e010a Added display of get-started modal after completing setup flow
refs https://github.com/TryGhost/Team/issues/1295

- moved `?firstStart` query param handling into `'home'` route as it seemed like a preferable location
  - switched to using `resetController` hook to manage removal of query param which seemed more reliable than the transition approach
- added `firstStart` query param to the transitions when completing step 3 of the setup flow
2022-02-01 18:20:26 +00:00
Peter Zimon 5d10f5d2f1
Contributors updates (#2235)
Updates Admin UX for Contributors

When logged in as a Contributor:

- removes sidebar, added floating account menu and dark-mode switch to right side. Updated mobile menu accordingly
- all post by the given user is listed in the Post list
- changed post filtering
- hides email columns in post list
- removes publishmenu for Contributors in Post preview modal
- visual tweaks
2022-02-01 18:59:20 +01:00
Kevin Ansfield 3561bd1d64 Added "Get started" modal for first-load onboarding
refs https://github.com/TryGhost/Team/issues/1295

- modal is triggered by the query param `?firstStart=true`, eg https://localhost:2368/ghost/#/?firstStart=true
- clears the query param after triggering the modal so it doesn't get re-triggered after leaving and re-entering the dashboard route
2022-02-01 17:47:50 +00:00
Gabriel Csapo a77b8e4963
Switched majority of files from EmberObject to native class syntax using @classic decorator (#2227)
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
2022-02-01 09:34:03 +00:00
Rishabh Garg db03891193
Updated specific tier visibility handling for posts/pages (#2233)
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
2022-02-01 12:24:06 +05:30
Sanne de Vries a488b93465
Improved Email newsletter settings page (#2207)
Updated email newsletter settings

- Added toggle to disable email newsletters
- Hides email related UI when email is completely turned off
- Rearranged email newsletter settings
- Added publish-menu preview in 
- Changed default-recipients setting
- Updated publish-menu to show Publish as default action
- Removed the confirmation modal during publishing when no emails are intended to be sent
2022-01-27 12:40:11 +01:00
Sanne de Vries ffc85b126b Updated Author user profile page and sidebar
No issue

- Authors don't need access to staff page and don't need to see breadcrumbs on their profile page
- There's enough space in the side navigation for the post views to be visible by default
2022-01-26 14:49:55 +00:00
Kevin Ansfield edfb8885eb Fixed errors thrown in integration tests
no issue

- errors were due to test setup rather than anything being broken
- cleans logged errors in test output
2022-01-21 23:45:47 +00:00
Kevin Ansfield 8e472e34bc
Ran `ember-cli-update --run-codemods` (#2219)
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()`
2022-01-21 19:25:47 +00:00
Kevin Ansfield 35dd9294ea Refactored member activity list components
refs https://github.com/TryGhost/Team/issues/1277

- renamed `<GhActivityTimeline>` to `<GhMemberActivityEventParser>` and modified so that it yields parsed events rather than directly renders them
  - makes the component re-usable as it can be used to decorate raw events ready for use in context-specific templates
  - switches to using a getter to yield the parsed events so that they will update automatically when the `@events` argument changes
- updated `<Dashboard::LatestMemberActivity>` to use `<GhMemberActivityEventParser>` and keep the member activity box output local to itself
- added integration tests for `<Dashboard::LatestMemberActivity>`
  - added Mirage setup for member activity event models/serializers/route
2022-01-19 12:58:09 +00:00
Kevin Ansfield 62a5757ace Added initial setup of members activity feed
refs https://github.com/TryGhost/Team/issues/1277

- added `/members-activity` route with associated controller, template, and components behind labs flag
  - table component currently renders some dummy rows
- added navigation item to main menu
  - will use the currently set `?filter` query param unless clicked whilst already on the `/members-activity` screen in which case it will reset the query
- added link to dashboard members activity panel
- added link to member details activity panel
  - sets the filter param to `?filter=member:{member.id}` in preparation for the feed to be filtered to the member's activity
- updated the labs-flag test helper file to export both `enableLabsFlag()` and the new `disableLabsFlag()` so it's easier to test for flag-disabled functionality
2022-01-17 18:06:12 +00:00
Kevin Ansfield 250ef845ee
Refactored away CurrentUserSettings mixin (#2200)
no issue

Mixins are deprecated in Ember so we want to remove their usage. The `CurrentUserSettings` mixin was used in Route files to provide `transitionAuthor()` (that also transitions contributors) and `transitionEditor()` methods so the the consuming route could use them to prevent access to authors/editors. In practice the only reason this was used was to prevent access to admin-only routes.

- added an `AdminRoute` class that inherits from our `AuthenticatedRoute` class
  - when any route inherits from this class it will only allow access to admins and owners, any other user will be redirected to the home screen (dashboard or site depending on permissions)
- updated all of our admin-only routes to use the new `AdminRoute`
  - allowed for removal of `CurrentUserSettings` mixin usage
  - allowed for `beforeModel()` hooks to be removed from consuming routes in many cases
  - some admin-only routes were extending/inheriting directly from Ember's `Route` based on the assumption that the router hierarchy would have a parent route perform the redirect. Those have also been switched to `AdminRoute` for consistency and to prevent accidentally making them available if the router hierarchy changes
  - `/#/settings` does not use the `AdminRoute` so that it can redirect to the current user's setting page for non-admin users
- removed `CurrentUserSettings` mixin file
- cleaned up unnecessary computed property and function used for redirect-when-disabled in the Zapier route
2022-01-17 10:05:27 +00:00
Kevin Ansfield 830a5d7fb8 Fixed editor test failing when run within 10mins of midday
closes https://github.com/TryGhost/Team/issues/854

- when testing the scheduling of a post we were grabbing a time 10 mins in the future and using that to set only the _date_ for the scheduled publish time. That causes problems because 10 mins in the future from just before midday with site set to a +12hr timezone as in the tests will move into tomorrow but without the associated change in scheduled time we've jumped forward 24hrs meaning the tests that were expecting the default +5min change when switching to a scheduled post would fail
2022-01-06 13:02:43 +00:00
Kevin Ansfield 3db79bdcb3 Fixed `?search=` empty param after members bulk delete
no issue

- the members query reset was using `""` rather than `null` due to a bug in an old version of search/filtering but that meant we could end up with an empty param
- switched to `null` as it no longer appears necessary to use a blank string, this matches behaviour of other params
2022-01-05 12:52:12 +00:00
Kevin Ansfield 15a82b1118 🐛 Fixed incorrect automatic CSV download when bulk-deleting members
closes https://github.com/TryGhost/Team/issues/1265

- we were generating the correct query params for the export endpoint but those query params weren't applied to the export URL before fetching it meaning the default GET behaviour of listing first 15 members was always being used when generating the backup CSV
2022-01-05 12:21:52 +00:00
Kevin Ansfield e3a86dc03a Fixed linter error
refs 1d80f463eb

- all uses of `sinon` were removed in the updated tests but the import was missed
2022-01-03 15:32:42 +00:00
Kevin Ansfield 1d80f463eb Updated <GhThemeTable> test
refs https://github.com/TryGhost/Team/issues/1164

- component integration tests were failing after `<GhThemeTable>` was replaced with `<GhThemeTableLabs>`
- updated tests to match new table component behaviour
2022-01-03 15:27:32 +00:00
Kevin Ansfield e5ae600efc Cleaned up `customThemeSettings` feature flag
refs https://github.com/TryGhost/Team/issues/1164

- removed flag and labs screen toggle
- removed all conditionals
- removed all old/unused route/controller/component files
- renamed labs components and classes to non-labs naming
2022-01-03 14:09:27 +00:00
Kevin Ansfield 6829efd597 🎨 Added confirmation dialog any time a post/page will be published
refs https://github.com/TryGhost/Team/issues/1169

Previously we were only showing a confirmation dialog if a publish action would trigger an email which was inconsistent and did not instil confidence when publishing.

- replaced old `modal-confirm-email-send` modal with the newer-style `modals/editor/confirm-publish` component
  - updated to handle standard publish in addition to email publish
  - updated copy
  - added "error" state when attempting to send email-only post to no members
- updated publish menu `save` task to open the confirm modal when going from `draft` to `published` or `scheduled`
  - underlying save with email polling moved to `_saveTask` so it can be re-used across `save` task (when not publishing) and when confirming from the modal
2021-12-07 00:18:24 +00:00
Kevin Ansfield a44d04cdac Removed empty card test files 2021-11-29 09:42:14 +00:00
Rishabh 063f29a406 Fixed lint 2021-11-19 19:41:02 +05:30
Rishabh e815a5b81f Added first pass of upload cards
refs https://github.com/TryGhost/Team/issues/1229
refs https://github.com/TryGhost/Team/issues/1230
refs https://github.com/TryGhost/Team/issues/1231
2021-11-19 19:34:17 +05:30
Kevin Ansfield d016cca5f0 Fixed tests expecting old theme settings screen
refs https://github.com/TryGhost/Team/issues/1164

- removed conditional logic for links on settings index now that the old theme settings routes do not exist
- updated error handling test to use new design settings screens
  - modified templates' test attributes to work with new design
- fixed `enableLabsFlag()` test helper error when fixtures have already been loaded
2021-11-10 12:45:26 +00:00
Peter Zimon 631245547f Removed obsolete integration files
- removed unused integration files (was restructured under Settings / integrations)
- removed unused routes
2021-11-05 13:42:38 +01:00
Peter Zimon 4f799e4c81 Fixed staff tests
- fixed all staff related tests after Admin route restructure
2021-11-04 09:40:24 +01:00
Fabien 'egg' O'Carroll f932e9657d
Removed Offers related usage of labs flag (#2134)
refs https://github.com/TryGhost/Team/issues/1115

This removes all the usages of the Offers labs flag which do not modify routing.
The routing changes have been left for @peterzimon
2021-11-03 16:55:45 +02:00
Kevin Ansfield e1346fdeca Fixed upgrade modal not showing when theme uploads are not allowed
closes https://github.com/TryGhost/Team/issues/1193

- there was a typo in the limits modal component name that is shown when the limits service check fails when opening the upload theme modal
- added acceptance test with associated fix of modal name test selector in the template
2021-11-01 18:35:21 +00:00
Kevin Ansfield a08fbf11c3 Added acceptance tests for new design screen
no issue

- moved navigation settings tests from old settings/design tests to a separate file and unskipped them
- added happy-path acceptance tests for
  - rendering design screen
  - installing an official theme from the themes list
  - uploading a custom theme
2021-11-01 17:48:49 +00:00
Kevin Ansfield cbbf33352e Fixed tests
refs fdfed8429b

- the editor test state has no email setup so the publish button will show "Publish" rather than "Publish & send"
2021-10-21 13:16:20 +01:00
Rishabh 00270bb0e3 Fixed offer tests
no refs

- adds new product fixtures
- allows loading of products data for offers page
2021-10-11 13:52:42 +05:30
Rishabh 8e865503cc Added basic acceptance tests for offers
refs https://github.com/TryGhost/Team/issues/1084
refs https://github.com/TryGhost/Team/issues/1085
2021-10-08 19:45:48 +05:30
Rishabh 1b8bf0e055 Added new enable labs flag helper for tests
no refs

- allows easily enabling alpha features for tests
2021-10-08 19:45:07 +05:30
Naz 35e5081874 Removed stray only statement 2021-10-07 13:10:20 +02:00
Naz 901beb076f Fixed failing test
refs https://github.com/TryGhost/Team/issues/1125
refs c77d8866b0
refs 04df65aaef

- The 'Publish & send' copy is now a default when publishing a post and has been missed to change in the refed commit
2021-10-07 13:09:55 +02:00
Naz 04df65aaef Fixed failing test
refs https://github.com/TryGhost/Team/issues/1125
refs c77d8866b0

- The 'Publish & send' copy is now a default when publishing a post and has been missed to change in the refed commit
2021-10-07 12:55:18 +02:00
Kevin Ansfield a3e99c8953 Fixed Slack integration test
refs db8928131b

- test was using an old `/settings/design` route as something to navigate away to but the behaviour no longer matched the test expectations
- switched to using `/settings` as a more stable route
2021-10-04 16:46:37 +01:00
Rishabh 4e2b627fe7 Fixed bulk delete members list test
no refs

- removes temporary comment on bulk delete member test as its updated to work with filtering in GA
2021-10-01 19:27:31 +05:30
Fabien O'Carroll 0f44e446dd Added Members Filtering feature
no-issue

This adds the ability to apply complex filters to members, as well as to
perform bulk actions on the filtered set, including unsubscribing,
adding & removing labels.
2021-10-01 14:16:28 +02:00
Kevin Ansfield e12163a713 Updated tests for draft "Saved" indicator
refs 401aeb6f71

- save status indicator now shows "Draft - Saved" so tests needed to match
2021-08-31 10:11:40 +01:00
Sanne de Vries e3552ac311 Styled publishing action dropdown in publish menu 2021-08-26 13:01:45 +02:00
Naz 6edaf16f46 Added publishing action dropdown to publish menu
refs https://github.com/TryGhost/Team/issues/947

- Added a "distribution" dropdown component to the post publish menu allowing to select from one of three available types of distribution: publish, poblush&send, and send
2021-08-25 22:20:11 +12:00
Rishabh 4860325964 🐛 Fixed incorrect MRR value on dashboard
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
2021-08-09 17:47:09 +05:30
Kevin Ansfield 7172715c34 Bumped eslint-plugin-ghost and fixed linter errors
no issue

- new linting rules that needed fixing:
   - calling `super` in lifecycle hooks
   - no usage of String prototype extensions
2021-07-15 15:27:29 +01:00
Thibaut Patel 48d092a436 Renamed isAdmin/isOwner/isAdminOrOwner to reduce confusion
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)
2021-07-12 14:55:56 +02:00
Kevin Ansfield 2663f5bbb1 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
Peter Zimon 807cfb8fa7 Updated character counter color 2021-07-08 15:15:49 +02:00
Rishabh a476d03d0d Added custom segment option to post settings access option
refs https://github.com/TryGhost/Team/issues/822

With multiple products flag we are re-enabling segmentation by product for posts. This change adds new segment option for post access option in post-settings menu, which allows option to choose specific products for post access.

- updates post settings and post settings labs menu to add new option for segment
- handles visibility filter changes for API based on selected segment
- the new behavior is behind the alpha flag for multiple products
2021-07-05 17:14:26 +05:30
Kevin Ansfield 986e1174dd Fixed editor tests
refs fb5e083ce9

- fixed linting errors
- fixed automatic clearing of invalid publish date when PSM is closed
  - previously the PSM was always rendered so it had a `showSettingsMenu` argument that told it whether it was being shown
  - automatic error clearing was tied to `showSettingsMenu` so it was switched to `willDestroyElement` because now the menu is re-rendered each time it's shown
- fixed tests
  - tests assumed the menu was always rendered so they were manipulating inputs even though they weren't visible on screen
2021-07-02 19:57:58 +01:00
Kevin Ansfield 18aebf8c9a Fixed tests
refs 0f24cb9ade

- fixed find/replace whoopsie with `slugGenerator.generateSlug()`
- updated editor controller unit tests to match rename
2021-06-21 15:18:11 +01:00
Kevin Ansfield 9d2c86c227 Switched to new component for labs feature image redesign
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
2021-06-16 17:56:25 +01:00
Kevin Ansfield 65ed9cc69c 🎨 Moved default focus in editor from body to title for new posts
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
2021-06-14 15:35:59 +01:00
Kevin Ansfield 1a4bba9201 Fixed "and sent to..." text appearing in scheduled header when not sending
refs 27363dfce3

- added conditional for displaying the recipient text
- fixed tests not expecting newlines in html
2021-06-11 12:10:28 +01:00
Kevin Ansfield 5bfd58f7c6 Fixed tests expecting `'(Untitled')` in editor title input
refs b979a2c41c

- updated to reflect changed behaviour
2021-05-27 18:52:35 +01:00
Kevin Ansfield 12be86047c 🎨 Reverted ability to set post access level to labels
refs https://github.com/TryGhost/Team/issues/581

Setting post visibility to a label results in undesirable and confusing behaviour with no good way to manage access long-term. Coupled with products being limited to a single product for now we're reverting the UI back to the "Public", "Members", and "Paid" options.
2021-05-14 16:01:14 +01:00
Kevin Ansfield f233ffda6f 🎨 Updated post settings menu visibility option to support member segments
https://github.com/TryGhost/Team/issues/581

The API now supports `posts.visibility` being an NQL string as well as the special-case `'members'` and  `'paid'` values so the post settings menu visibility select needs to be updated to reflect that.

- swapped visibility dropdown for two radio buttons, "Public" and "Members-only" which uses the `<GhMembersSegmentSelect>` component
- updated post model to use a `visibility-string` transform
  - converts `members` and `paid` to/from the NQL equivalent for correct display in the segment select
- updated post model with two additional properties `isPublic` and `visibilitySegment`
  - `isPublic` helps with the radio button display
  - `visibilitySegment` allows fallback to the default content visibility setting when set to public
- added validation for `post.visibility` so we can show an error and skip saving when members-only is selected and the segment select is cleared
- deleted the now-unused `<GhPsmVisibilityInput>` component
2021-05-10 20:34:23 +01:00
Kevin Ansfield 07abd8508a Fixed members list query not always matching route params
refs e46738dbf2

- referenced refactor accidentally removed direct usage of `params` in `fetchMembersTask()`
- because it's called from the `model()` hook the query param properties on `this` have not yet been updated to the new params meaning we were querying the API with stale params
2021-04-08 16:00:43 +01:00
Kevin Ansfield 605ca321c8
Added ability to bulk delete members by label or status (#1883)
refs https://github.com/TryGhost/Team/issues/585
requires https://github.com/TryGhost/Ghost/pull/12082

When a label or status filter is selected on the members screen show a "Delete selected" option in the actions dropdown. Bulk deleted members will _not_ have any subscription data modified in Stripe, if a member should be deleted and have their subscription cancelled it's necessary to do that on a per-member basis.

- updated bulk delete handling to match API
- added link to bulk delete confirmation modal in members actions dropdown (only shown when label, status, or search is used)
- updated testing framework for members
  - added label factory for easier test setup
  - updated `GET /members` and `DEL /members` endpoints to work with label filters
  - updated test selectors for easier reference in tests
2021-04-08 12:06:27 +01:00
Naz 047df0a98f Added integration with limit service
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.
2021-04-08 16:59:56 +12:00
Sanne de Vries ef98d3014f
Clarified staff user roles in Admin (#1874)
refs https://github.com/TryGhost/Team/issues/572

- Replaced dropdown in invite-user modal with radio buttons
- Added description for each user role
- Added icon to provide more info on hover for each role
- Got rid of unused box styling
2021-04-07 15:20:30 +01:00
naz efb7c5c2c7
🐛 Fixed host limit error when resending a pending invite (#1881)
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>
2021-04-06 15:10:03 +12:00
Sanne de Vries c43a48b198 Fixed test 2021-03-23 12:42:23 +01:00
Rishabh Garg 5da8a087b3
🐛 Fixed MRR start date value in chart (#1865)
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
2021-03-15 15:23:55 +05:30
Sanne de Vries 3c68adbced Changed all green and blue modal buttons to black 2021-03-05 13:16:43 +01:00
Peter Zimon 00f20bc3c4 Using accent color on login button 2021-03-03 13:36:44 +01:00
Peter Zimon 1b1dbff6d4 Basic sign in UI update
- updated sign in UI to match better with the rest of Ghost.org
2021-03-02 17:40:35 +01:00
Kevin Ansfield 47cf3bd21f Removed tour feature
refs 5267377965
refs b027e1c630

- 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
2021-03-02 14:29:26 +00:00
Kevin Ansfield 4c8c71bf93 Fixed tests
refs 7e28cf6be8

- referenced commit changed `dashboard` to redirect to `site` when logged in user is not an owner or admin
- updated tests to reflect the change
2021-02-24 15:56:18 +00:00
Kukhyeon Heo 198f111524
Added YAML file support for redirects (#1703)
refs https://github.com/TryGhost/Ghost/issues/11085
refs https://github.com/TryGhost/Ghost/pull/12187

- YAML file support has been added to Ghost's API through referenced above PR. YAML will become a default supported file in the next version of Ghost replacing JSON redirects
2021-02-22 13:27:00 +13:00
Naz f8acb8a972 Removed more leftover unsplash code & fixed tests
refs refs 244e824e50

- Found some more unnecessary code for previous unsplash setting structure and removed it.
- Refactored the tests to be more in line to how AMP tests are done
2021-02-18 15:03:53 +13:00
naz 244e824e50
Fixed EmberObject.create error on Admin start (#1841)
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
2021-02-18 13:25:21 +13:00
Peter Zimon 5c9a648c65 Refined buttons on staff screens 2021-02-12 16:58:04 +01:00