Commit Graph

752 Commits

Author SHA1 Message Date
Simon Backx 492702304e Added basic newsletter creation test
refs https://github.com/TryGhost/Team/issues/1477

- Very basic test only
- Includes some extra test attributes in the components
- Commented out a test that was not yet fininished
2022-04-28 10:50:27 +02:00
Rishabh Garg 2d2472f18d Updated route for newsletter settings (#2353)
- updates newsletter settings route to `/settings/newsletters` for GA
2022-04-26 13:10:16 +01:00
Simon Backx b49f588f61 Readded multipleProducts flag in member filter tests 2022-04-26 13:10:16 +01:00
Simon Backx 85bd83409c Removed blank line that failed linting 2022-04-26 13:10:16 +01:00
Simon Backx e50ff49409 Fixed test linting error 2022-04-26 13:10:16 +01:00
Simon Backx eb5d82c0ef Fixed tests partially for updated member counts
no issue

Also moves some reused test methods to the test helpers folder (wasn't able to move it to the fixtures because too many tests were failing):
- enableNewsletters helper
- enableStripe helper
- enableMailgun helper
2022-04-26 13:10:16 +01:00
Kevin Ansfield 7179739361 Fixed conflicting test selector in <GhTaskButton>
refs 938a1d54c2

- we use `data-test-state` inside of some modals which also use `<GhTaskButton>` which caused unrelated tests to start failing due to a change in matching element counts
2022-04-19 20:42:47 +01:00
Kevin Ansfield 938a1d54c2 Fixed `<GhTaskButton>` behaviour
refs b377927d26

- the conditional for `isFailure` was wrong meaning we were showing the idle state unintentionally
- fixed the conditional so it checks for the return value rather than a `null` error
- updated the template with test selectors so it's easier to determine state where class names are not sufficient to differentiate
2022-04-19 20:25:27 +01:00
Kevin Ansfield 4a8dcb9bab 🐛 Fixed close button on "unsaved changes" modal not always behaving like "Stay" button
no issue

The close button in the unsaved changes modal used the `@close` action directly compared to the "Stay" button which used `(fn @close false)`. The close button version without explicit arguments resulted in the first argument being a `PointerEvent` instance which if checked as a modal return value as `if (shouldClose)` would evaluate as truthy therefore matching the "Leave" behaviour instead of the "Stay" behaviour.

- changed modal to explicitly call `(fn @close false)` when the close button is clicked
- updated design settings route to have an explicit `shouldLeave === true` check so default behaviour is always "Stay"
2022-04-14 12:39:10 +01:00
Peter Zimon bf0c3cbd1a
Updated Portal mock for offers (#2319)
Updated the preview block of offer creation screen to match the new style of Portal.
2022-04-01 13:22:41 +02:00
Kevin Ansfield e2c1913b5a 🐛 Fixed scheduled send-only post switching to publish+send when rescheduling
closes https://github.com/TryGhost/Ghost/issues/14354

When setting/cleaning up the publish menu state we were incorrectly reverting to the default "publish & send" state when a post was already set to be email-only. This resulted in an unexpected and non-obvious switch to "publish & send" when re-scheduling a scheduled email-only post.

- updated the publish menu setup and cleanup routines to account for scheduled, email-only posts
- fixed the header in the publish menu to say "sent" rather than "published" when an email-only post is scheduled
2022-03-31 17:11:06 +01:00
Kevin Ansfield 5c09a49a95 Fixed newsletter settings tests
refs f16afddb05

- label's "for" was removed to enable more direct use of the checkbox enabling keyboard usage but the test was not updated to reflect the change
2022-03-31 11:37:38 +01:00
Kevin Ansfield d27db1091c Created labs versions of members-email settings code
refs https://github.com/TryGhost/Team/issues/1441

- duplicated route/controller/template and component to `-labs` versions so larger changes and refactors can be made without affecting the GA code
- added redirect for `/settings/members-email -> /settings/members-email-labs` when `multipleNewsletters` flag is enabled
- cleaned up multiple-newsletters related code from the non-labs component
2022-03-31 11:06:21 +01:00
Kevin Ansfield d308239a8e Improved test output readability for custom views failures
no issue

- test was failing locally due to a bad dependency version but the "expected null to exist" error was not very helpful
- added custom messages to the expectations so it's immediately obvious which expectation has failed, eg "custom view modal (on add): expected null to exist"
2022-03-31 10:52:54 +01:00
Kevin Ansfield 7b2bef99e7
Cleaned up `membersActivityFeed` labs flag (#2309)
no issue

- `membersActivityFeed` is GA so we don't need any of the conditionals or now-unused code
2022-03-30 12:43:52 +01:00
Rishabh Garg 1f86d1ecff
🐛 Fixed error on saving a paid member (#2312)
refs https://github.com/TryGhost/Team/issues/1435
refs f5f69d01b1

A recent change for showing all subscriptions of a member on detail screen introduced a circular json structure with subscription -> tiers -> subscriptions, which throws an error on saving any member with paid subscription on member detail screen.
2022-03-22 21:58:21 +05:30
Simon Backx 3ee090d843 Fixed linting issues in dashboard 5 component 2022-03-22 09:58:42 +01:00
Simon Backx f533562869 Added dashboard 5.0 component
refs https://github.com/TryGhost/Team/issues/1431
2022-03-21 18:08:13 +01:00
Thibaut Patel f5f69d01b1
Added canceled subscriptions in member detail screen (#2287)
refs https://github.com/TryGhost/Team/issues/1141

Showing canceled subscriptions provide a more complete picture of the activity of a member.

- Given there is no `member.product` object when a subscription is canceled, use the `member.subscriptions.price.product` objects instead of `member.products`.
- applied boy-scout rule for linter errors and and code formatting
- removed `multipleTiers` flag conditionals as it's now GA
- set up subscriptions as a separate mirage resource so they are easier to work with
    - updated `PUT /members/:id/` endpoint to match real API's complimentary subscription behaviour
    - modified mirage member serializer to match API output

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2022-03-18 16:15:42 +00:00
Kevin Ansfield 0a864af53e 🐛 Fixed duplicate email open rate column when filtering members by open rate
no issue

- email open rate is shown by default so we don't need to add the column a second time when the list is filtered by that data
- added `email_open_rate` to the default columns list so it's ignored when adding any filtered-by columns
2022-03-17 09:29:15 +00:00
Kevin Ansfield 7b95cc230e 🐛 Fixed slow loading and high memory usage of members list screen
refs https://github.com/TryGhost/Team/issues/1423

- problem:
  - all members requests were automatically adding `?include=email_recipients` as the email recipients relationship was set up to be always embedded
  - embedded email_recipient records also embed the whole email record
  - on the members index screen this meant for each of the 50 members loaded on a page we were also loading every email they have ever received resulting in a huge API response
  - this was not a problem previously because the API was ignoring the `include` parameter on the browse endpoint and Admin wasn't formatting the include properly in snake_case
- solution:
  - the only place we need associated email recipients is on the member details screen where they are used to show the email activity feed
  - removing the `{embedded: 'always'}` option for the `member.emailRecipients` association stops `?include=email_recipients` being added automatically to every members request
  - the member details screen explicitly adds `?include=email_recipients` so no further changes are needed
  - activity feed will be changing to use proper event objects in the future and further optimisation can be made
2022-03-15 18:26:24 +00:00
Sanne de Vries a873ad7ac9 Fixed test 2022-03-11 12:52:30 +00:00
Kevin Ansfield 6d97abd8ba 🐛 Fixed "Must be in the past" error when closing and re-opening publish menu whilst scheduling
closes https://github.com/TryGhost/Team/issues/1399

- the publish/schedule save type was not being reset when closing the publish menu, even though the underlying post publish date _was_ reset leading to the publish menu and the post state being out of sync
- added a reset of the save type when closing the menu, this means "schedule" will need to be re-selected when re-opening the menu but that follows the same behaviour as the reset of the publish menu options
2022-03-11 10:13:08 +00:00
Kevin Ansfield 19e606c614 Updated members bulk-delete test for change of default filter
refs 4c3412c210
refs 54eb037e3f

- test was set up expecting "Label" to be the default filter shown when opening the members filter UI but it's been changed to "Name" which is no longer behind a labs flag
2022-03-10 17:05:15 +00:00
Kevin Ansfield 4c3412c210 Added "Name" and "Email" filters to members screen
closes https://github.com/TryGhost/Team/issues/1408
closes https://github.com/TryGhost/Team/issues/1409

- adds new text-based filters that match against member names and emails that allows more specific filtering than search
  - new filter operators introduced for "contains", "does not contain", "starts with", and "ends with"
2022-03-10 16:45:24 +00:00
Kevin Ansfield cef00156ef Added "Email" members filter
refs https://github.com/TryGhost/Team/issues/1409

- added filter property definition using the same "contains" operators and parsing supported added for the "Name" filter
2022-03-09 16:05:28 +00:00
Kevin Ansfield cf3afa9247
Added "Name" members filter (#2289)
refs https://github.com/TryGhost/Team/issues/1408

- switched to `@tryghost/nql` packages to get access to latest releases
- updated `GET /members` mirage endpoint with a try/catch and explicit logging to make any errors from NQL more visible
- added "Name" filter option
  - has `is`, `contains`, `does not contain`, `starts with`, `ends with` operators
  - uses a plain text field for the input value
- added support for `~`, `-~`, `~^`, and `~$` operators when generating NQL queries from filter definitions
2022-03-08 21:30:20 +00:00
Kevin Ansfield 00646555e0 Added "Last seen" filter to members screen
refs https://github.com/TryGhost/Team/issues/1418

- adds "Last seen" option to members filtering that lets you filter by date a member last logged in or opened an email with `before`, `on or before`, `on or after`, and `after` options
- adds "Last seen on x" data to the member details screen
2022-03-08 20:21:49 +00:00
Kevin Ansfield f998fe6ff0 Fixed linter error for unused variable in dashboard-test.js 2022-03-08 19:23:03 +00:00
Kevin Ansfield 6b71408afa Updated dashboard acceptance tests for latest member graphs/resources box behaviour
refs https://github.com/TryGhost/Team/issues/1376

- adjusted tests so they are in sync with expected dashboard behaviour
- removed `dashboardHideGettingStarted` feature and it's usage in the `showMembersGraphs` property as there's no longer a resource box to dismiss
2022-03-08 19:20:12 +00:00
Kevin Ansfield cfbbd70487 Cleaned up members filter nql parsing/generation
refs https://github.com/TryGhost/Team/issues/1419

- small cleanups to remove unnecessary duplication
2022-03-08 19:07:46 +00:00
James Morris 60f03b1946 Updated tests to remove the Resources Banner from Dashboard
refs: https://github.com/TryGhost/Team/issues/1376
2022-03-08 19:04:11 +00:00
Sanne de Vries c7c6f9ca41
🎨 Redesigned user authentication pages (#2286)
Refs https://www.notion.so/ghost/Invite-staff-users-steps-in-setup-guide-367737e13d97450a98a0f39ec6b68181

* Simplified the selfhoster setup flow to one setup page only
* Redesigned the reset password pages and the signup page for new staff members

Co-authored-by: Daniel Lockyer <hi@daniellockyer.com>
2022-03-08 17:30:46 +00:00
Kevin Ansfield 66290622e0 Resolved ember-cli-mirage import deprecations
refs https://github.com/TryGhost/Admin/pull/2209

- `miragejs` has been extracted to a framework-independent library, the re-exports of `miragejs` elements in `ember-cli-mirage` have been deprecated making our test logs very noisy
- added `miragejs` as a top-level dependency
- updated all relevant imports to pull from `miragejs` instead of `ember-cli-mirage`
2022-03-08 11:32:01 +00:00
Kevin Ansfield bddd426569 Hid members graphs in dashboard until get-started block dismissed or members added
refs https://github.com/TryGhost/Team/issues/1406

- added fetch of a single member to the dashboard initialisation if we don't already have some members loaded in memory
- added `showMembersGraphs` getter used in the conditional for rendering the members graphs block component
  - if `improvedOnboarding` flag is disabled, return `showMemberData` so existing functionality is retained
  - will return `false` if until the single-member fetch has completed if we don't already have any members in memory
  - returns `true` if any members exist or the "get started" dashboard resources block has been dismissed
2022-03-07 13:26:52 +00:00
Kevin Ansfield b948054f51
Added shortcut buttons to "Last seen" members filter datepicker (#2291)
refs https://github.com/TryGhost/Team/issues/1410

- added block invocation support to `<GhDatePicker>` that exposes the calendar components used inside the datepicker dropdown allowing for customisation of the dropdown content
- updated "last seen" datepicker to use the block invocation support to add buttons that select typical "time ago" dates

Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2022-03-04 17:09:28 +00:00
Kevin Ansfield 87a69ecd05 Switched members table to show info from most-recently-updated subscription instead of first in array
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
2022-03-04 16:32:41 +00:00
Simon Backx 5e8afa8836
🐛 Remove empty benefits before saving (#2284)
refs https://github.com/TryGhost/Team/issues/1188

- The api throws a validation error when we try to add benefits with an empty name
- Before saving, we remove benefits with an empty name
- Added test for empty benefit names
2022-03-04 17:00:09 +01:00
Kevin Ansfield dcef9ea52b Switched "Last seen" filter to standard date picker filter
refs https://github.com/TryGhost/Team/issues/1410

- we have problems translating an "x days ago" NQL filter back to the UI component so as a temporary measure we're switching to a datepicker input as we have a working solution for that
- a later iteration will add shortcut buttons for selecting typical "x days ago" dates in the datepicker
2022-03-04 13:55:32 +00:00
Kevin Ansfield 760f0c2ed1
Added "Created", "Paid start date", and "Next billing date" date-based filters to members list screen (#2290)
no issue

- allows for filtering members by additional fields using a date picker with `before`, `on or before`, `after`, and `on or after` queries
2022-03-04 12:10:35 +00:00
Kevin Ansfield 157cd41583 Updated members filter datepicker error messages
no issue

- shortened invalid date format error message in `<GhDatePicker>` to "Date must be YYYY-MM-DD" so it's less likely to wrap
- added `@maxDateError` and `@minDateError` arguments to `<GhDatePicker>` allowing override of the default "Must be on or before xxxx-xx-xx" message shown when the inputted date is outside of the allowed range
- updated `<GhDatePicker>` usage in the "Created" member filter to use "Must be in the past" error message when a future date is selected
2022-03-04 09:32:59 +00:00
Kevin Ansfield 0aa5f8d331 Added "Next billing date" members filter
no issue

- added datepicker based filter for the next billing date of paid subscriptions
- updated table to add "Next billing date" column when filtered, showing the paid subscription's current period end date
2022-03-03 22:43:50 +00:00
Kevin Ansfield d859b9fc79 Added "Subscription start date" members filter
no issue

- added datepicker based filter for the start date of paid subscriptions
- updated table to add "Start date" column when filtered, showing the paid subscription's start date
2022-03-03 19:38:28 +00:00
Kevin Ansfield f586c64818 Changed default date filter operator to "on or before"
no issue

- prevents automatically filtering out all of today's members as soon as a "Created" filter is added as happened when the default was "before"
2022-03-03 19:14:33 +00:00
Kevin Ansfield 0dadd22bc1 Fixed initial "Create" member filter date not always matching "today" in site timezone
no issue

- updated default date filter values so they match the date in the site timezone rather than local timezone
  - fixes problems such as defaulting to 2022-03-01 when you're in UTC@4AM but the current date in the site timezone of UTC-5 at that time is 2022-02-28
2022-03-03 18:52:06 +00:00
Kevin Ansfield af8072a295 Updated "Created" member filter to work against site timezone instead of UTC
no issue

- updated NQL generation to adjust dates in filter string so they are the UTC equivalent
  - eg, in UTC-5 "created on or after 2022-02-22" becomes `created_at:>='2022-02-22 05:00:00'`
- updated NQL parsing to take a UTC date filter, convert to a date in the site timezone, then convert to a local date in a way that the datepicker input value matches the respective site timezone date
  - eg, in UTC-5 `created_at:<='2022-02-22 04:59:59` becomes "created on or before 2022-02-21"
2022-03-03 18:17:14 +00:00
Kevin Ansfield b231ef39a9 🐛 Fixed members table showing dates in UTC rather than site timezone
closes https://github.com/TryGhost/Ghost/issues/13611

- added `{{moment-site-tz}}` helper for transforming any date into the selected site's timezone
  - allows for use on any date in the system
  - keeps transformation a display-level concern
- updated members table to use `{{moment-site-tz}}` to transform the date before display
2022-03-03 16:16:46 +00:00
Kevin Ansfield 7688890dd5 Fixed invalid NQL syntax when using "created on or after" filter
no issue

- the "on or after" filter generation was missing the trailing quote around the date literal causing an "Error parsing filter" error
2022-03-03 10:11:16 +00:00
Kevin Ansfield 0fb37a0f35 Added "created at" members filters
refs https://github.com/TryGhost/Team/issues/1390

- added `membersTimeFilters` feature flag and labs toggle
- added `<GhDatePicker>` component that lifts functionality from the `<GhDateTimePicker>` component
  - `<GhDateTimePicker>` has not yet been refactored to use the new component internally as there are some odd/complex interactions with error handling with it's existing use-cases and they are in critical publishing paths so the refactor doesn't belong as part of this change
- added "Created at" filter type to members filters
  - uses new date picker component for input value
  - has "before", "on or before", "after", "on or after" operators
  - "on" and "not on" operators were skipped as they require two NQL statements to represent, breaking the current 1:1 statement:filter approach used in the NQL-based query param parsing
2022-03-02 21:59:48 +00:00
James Morris 62ee8d07d3 Removed test case for Finishing Touches button that doesn't exist anymore to stop tests failing
no issue
2022-03-02 13:36:18 +00:00