Commit Graph

91 Commits

Author SHA1 Message Date
Daniel Lockyer
1068070bd2 Renamed passwordreset body object to password_reset
refs https://github.com/TryGhost/Toolbox/issues/308

- I've just renamed the endpoint to `password_reset` but we might as
  well change the body object to make the change in v5 too
2022-04-28 15:33:09 +01:00
Daniel Lockyer
5aa5770791 Renamed /passwordreset authentication API endpoint to /password_reset
refs https://github.com/TryGhost/Toolbox/issues/308

- we have a pattern of splitting words via an underscore in the API, so
  v5 splits apart `passwordreset` to `password_reset`
- I'll follow up whether we want to fixup the `passwordreset` body
  object
2022-04-28 15:33:09 +01:00
Rishabh Garg
c15711434f 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
18f4748e8b 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
502fcaba3c Added "Opt-in existing subscribers" option to newsletter creation
refs https://github.com/TryGhost/Team/issues/1528

- adds "opt-in existing" toggle to newsletter modal that's only shown when creating a newsletter
  - defaults to true
- updated newsletter save flow to show confirmation before creation
  - alters message to reflect auto-subscribe selection
  - count of existing subscribed members is not implemented as it's not yet supported by the API
- updated newsletter adapter and save flow to use auto opt-in selection
  - when option is checked the save URL is changed to `POST /members/?opt_in_existing=true`
- modified task button component to ignore a task return value of `canceled` so when it's received the buttons returns to the idle state instead of showing a saved or failed state
  - used by save routine when the "Back to edit" button is clicked in the create confirmation modal
2022-04-19 20:01:08 +01:00
Kevin Ansfield
86a69ece65 Updated newsletter email verification endpoint
refs https://github.com/TryGhost/Ghost/pull/14491

- API endpoint used when completing verification of a newsletter email change has moved to `PUT /newsletters/verifications/` to follow our API patterns
2022-04-19 19:34:59 +01:00
Kevin Ansfield
e398557a75 Added sender email verification flow for newsletters
refs https://github.com/TryGhost/Team/issues/584
refs https://github.com/TryGhost/Team/issues/1498

- updated newsletter save routine in `edit-newsletter` modal to open an email confirmation modal if the API indicates one was sent
  - modal indicates that the previously set or default email will continue to be used until verified
  - response from API when saving looks like `{newsletters: [{...}], meta: {sent_email_verification: ['sender_name]}}`
  - added custom newsletter serializer and updated model so that the `meta` property returned in the response when saving posts is exposed
    - Ember Data only exposes meta on array-response find/query methods
    - https://github.com/emberjs/data/issues/2905
- added `/settings/members-email-labs/?verifyEmail=xyz` query param handling
  - opens email verification modal if param is set and instantly clears the query param to avoid problems with sticky params
  - when the modal opens it makes a `PUT /newsletters/verify-email/` request with the token in the body params, on the API side this works the same as a newsletter update request returning the fully updated newsletter record which is then pushed into the store
- removed unused from/reply address code from `<Settings::MembersEmailLabs>` component and controller
  - setting the values now handled per-newsletter in the edit-newsletter modal
  - verifying email change is handled in the members-email-labs controller
- fixed mirage not outputting pluralized root for "singular" endpoints such as POST/PUT requests to better match our API behaviour
2022-04-13 19:34:58 +01:00
Kevin Ansfield
e5c26aac89 Added newsletter dropdown to publish menu
closes https://github.com/TryGhost/Team/issues/1479

- updated post adapter to append `?newsletter_id=xyz` when passed a `newsletterId` adapterOption
- updated editor save task to pass `options.newsletterId` through as `adapterOptions.newsletterId`
- set up `post.newsletter` relationship ready for handling embedded newsletter association from the API
  - explicitly deleted when serializing back to the API as it doesn't yet ignore the attribute
- updated `<GhPublishmenu>` for newsletter support
  - fetches newsletters on first render so they are available in the dropdown
  - sets "default" (first in the ordered list) newsletter as the initially selected newsletter
  - adds newsletter dropdown to draft publish menu
  - passes `newsletterId` option to editor save task when it's set

This is a minimal implementation for testing. Not included:
- correct free/paid member counts based on selected newsletter
- correct member count in confirmation modal
- indication of selected newsletter for scheduled post
2022-04-06 10:22:06 +01:00
Kevin Ansfield
6e0be9e175 Wired up newsletter management with real newsletter model and API
refs https://github.com/TryGhost/Team/issues/1441

- switched "leave settings" confirmation modal on members email settings screen over to modern modal pattern
- removed unused `showEmailDesignSettings` property and `closeEmailDesignSettings()` action on `<Settings::MembersEmailLabs>` component
  - the used property and action live on the controller, looks like it was a copy/paste hangover when functionality was moved to a component
- added newsletter model
  - includes design-related attributes which are not yet supported by the API but are due to be added
  - includes `default` attribute but there is no setting for it, due to be removed from the API but it's needed for save not to error for now
  - set up basic mirage model and endpoints
  - added validation for main settings to match API validation
- added `EditNewsletter` modal
  - separate tabs for general newsletter settings and design-related settings
  - used for both creating and editing newsletters
- added `/settings/members-email/newsletters/new` and `/settings/members-email/newsletters/:id` routes
  - both display the `EditNewsletter` modal on top of the members-email settings screen with the appropriate newsletter model
- updated `<Settings::MembersEmailLabs::NewsletterManagement>` component to work with real newsletter model instances and the new add/edit routes
- removed now-unused `newsletter` service that was providing mocked data for earlier design iteration
2022-04-04 19:30:52 +01:00
Thibaut Patel
a47b61c1d4 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
f65437b14c 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
c4c48d4104 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
Rishabh Garg
c1ad9475d7 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
36ba447de0 Fixed mirage setup for members
refs 2bf311edc8

- added missing relationship definitions for included relationships on member model
- cleaned up unnecessary forcing of `id: 99` when creating new records of some models
2022-02-23 14:21:28 +00:00
Kevin Ansfield
4b646d40ea 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
80c6f93b21 Removed errant console.log 2022-02-15 21:41:12 +00:00
Kevin Ansfield
03defc274e 🐛 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
995673ad3c Added acceptance test for members search
refs https://github.com/TryGhost/Team/issues/1336
refs bf9bbc3aa6

- 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
09a97779b2 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
16781fbc0f Fixed linter error
refs 92ece7b373

- removed unused import that was left over from an earlier approach
2022-01-19 13:15:19 +00:00
Kevin Ansfield
92ece7b373 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
6f506b3e30 Fixed linter error 2021-11-01 18:40:47 +00:00
Kevin Ansfield
7251b1acac 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
Rishabh
31e4b77525 Added initial wiring for offer screens
refs https://github.com/TryGhost/Team/issues/1084
refs https://github.com/TryGhost/Team/issues/1085

- adds model/validator/config and router for offers
- updates template for offer list and detail with dynamic values
- updated route handling for offer list and creation
- wires offer data from API to list and detail pages
2021-10-06 20:01:25 +05:30
Kevin Ansfield
1ad2c05d37 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
Kevin Ansfield
6b6f220300 Fixed tests
no issue

- added basic products mocked endpoint
- fixed error when extracting filter param when filter is empty
2021-05-10 21:02:54 +01:00
Kevin Ansfield
59a37dc984 Fixed faker.random.number rename warnings
no issue

- `faker.random.number` is now `faker.datatype.number`
2021-04-12 15:32:39 +01:00
Kevin Ansfield
733f76d571 Added automatic CSV export when bulk deleting members
refs https://github.com/TryGhost/Team/issues/585

- updated bulk destroy task to first use the current query params to fetch from the appropriate CSV export endpoint and trigger a download
  - fetches via JS and triggers download from a blob URL link instead of an iframe so that we can be sure the download is successful before we hit the bulk delete endpoint
  - works differently to user deletion download because the server is not generating an export file and saving it meaning the client has to be sure we don't delete data before it's exported
- updated copy in the confirmation modal to reflect the download behaviour
2021-04-08 16:06:00 +01:00
Kevin Ansfield
72590083f3 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
Sanne de Vries
2e8109d05f 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
Rish
a5b60e4136 Updated mock member stats to use new count endpoint
refs 72e8894eac

- Fixes tests
2021-04-06 14:38:45 +05:30
Thibaut Patel
b16b4bcdc7 Added staff personal tokens
refs TryGhost/Ghost#12373
2020-11-20 10:23:19 +01:00
Kevin Ansfield
b590ce1b95 Implemented first iteration of content snippets
closes https://github.com/TryGhost/Team/issues/411

- adds "Create snippet" icon to the editor toolbar
- uses the same link input component design for specifying snippet titles
- snippets are loaded in the background when the editor is accessed
- snippets are listed at the bottom of the card menus of the + and / menus
- clicking a snippet inserts the snippet's contents in place of the current blank section
2020-10-15 18:03:35 +01:00
Kevin Ansfield
44b9b0fc94 Resolved "already declared in upper scope" linting warnings
no issue

- fixed all `no-shadow` linter warnings
- changed `no-shadow` eslint rule from `warn` to `error` so we don't re-introduce shadowed variables in the future
2020-10-05 09:56:21 +01:00
Kevin Ansfield
8984c0ae32 Updated to fetch settings using /settings/?group= instead of ?type=
refs https://github.com/TryGhost/Ghost/issues/10318

- primary change is in the settings service which is the only place we fetch the settings endpoint
- mocked APIs and fixture data updated to expect and to filter on `?group` rather than `?type`
2020-06-24 14:23:51 +01:00
Kevin Ansfield
9348858bbe Added missing renames of settings groups
refs https://github.com/TryGhost/Ghost/issues/10318, 6d83c30f01

- the mocked settings endpoint was not returning any settings created with the old `blog` key which broke tests
2020-06-23 21:05:11 +01:00
Kevin Ansfield
eee84ab5f7 Added first pass bulk members delete confirmation and results display
no issue

- display a confirmation modal when bulk deleting members
- hit the `DELETE /members/?all=true` endpoint when confirming
- show counts of members deleted/skipped
- fix selection reset when leaving edit mode
2020-06-19 18:14:41 +01:00
Kevin Ansfield
26f3d48f5d Updated members screen to work with final stats API naming
refs 071ab9774b

- stats API uses snake_case rather than camelCase to be consistent with the rest of Ghost's APIs
2020-05-26 12:26:04 +01:00
Kevin Ansfield
fb1c048f24 Removed "members" from mocked stats API payload property names
no issue

- removes duplication from property names as the "members" part is implicit from the resource name
2020-05-25 10:35:39 +01:00
Kevin Ansfield
8c19ea9cf9 Updated <GhMembersChart> to fetch stats from the API
no issue

- added mocked API for `/admin/members/stats/` that generates random data for the chart
- re-architected `<GhMembersChart>` to fetch data from the API rather than calculating stats from all members loaded in memory
- enabled mirage in development so that the chart can be tested before the live API is ready
2020-05-22 17:58:45 +01:00
Rishabh Garg
78e453c1b0 Fixed tests for labels (#1493)
no issue

- Updated member settings css property in tests
- Added mock for label API
2020-02-14 16:37:25 +05:30
Naz Gargol
c41c184762 Added member "add" screen (#1411)
no issue

- We have a need to create a member manually, this changeset solves this problem.
- Added new member button to the member's screen
- Needed to be able to perform add member action
- Fixed inconsistent `createAt` naming. All models use consistent `createdAtUTC`, fixed it up so that members model follows the same pattern. If we want to change this pattern should probably happen for all models at once
- Fixed member avatar when creating a new member. If the values are completely empty the screen ends up being filled with empty space. Added some dummy initials which are recalculated once the member enters the name or an email
- Refactored DS naming for consistency. Nowhere else in the codebase 'DS' name is ever used, made this consistent
- Added missing validations in members form
- Simplified if conditions in the member list template. When using the if/esle statements unnecessary new-line symbols were inserted which made it hard to test. Also by using computed property view is much cleaner
- Updated member's model default value for `subscribed` to "true". It is turned on by default in the model layer  on the backend (ref: https://github.com/TryGhost/Ghost/blob/3.1.0/core/server/data/schema/schema.js#L330), this behavior is intended and should be the same on the frontend
2019-11-28 18:30:21 +07:00
Kevin Ansfield
41e1cf3ecb Fixed tests 2019-11-08 11:14:04 +07:00
Naz Gargol
7e3412ce8e 🔥 Removed all subscriber feature related code (#1337)
refs https://github.com/TryGhost/Ghost/pull/11153

- Removed all subscriber feature related code
- The feature is being substituted by members
2019-09-26 15:58:01 +02:00
Kevin Ansfield
457a8e2955 🎨 Added auto-login to private site when viewing site preview in admin (#1286)
closes https://github.com/TryGhost/Ghost/issues/10995

- when first loading the site preview, if private mode is enabled submit the login form in the background to get the cookie before loading the iframe
- refactors post-authentication preloading to ensure it occurs before post-authentication route hooks are called
- adds `showSuccess` attribute to `<GhTaskButton>` so that when set to `false` it can stay in the running state after "success" to avoid state change flashes whilst waiting for a transition
2019-08-12 09:11:10 +01:00
Kevin Ansfield
4ae9151923 Fix linting errors
refs https://github.com/TryGhost/Ghost-Admin/pull/1274

- fixes errors introduced from upgrading to eslint@6
2019-07-22 11:21:24 +01:00
Kevin Ansfield
a7f4610381 Removed usage of ember-light-table in subscribers screen (#1191)
no issue

`ember-light-table` is falling behind Ember.js and other addon development and is increasingly causing issues with Ember deprecations and addon incompatibility.

- swaps `ember-light-table` usage for a straightforward table using `vertical-collection` for occlusion
- uses the same loading mechanism as the members screen with a slight optimisation where the initial load will fetch subscribers in batches of 200 until they are all loaded
- removes now-unused pagination mixin
- fixes duplicate subscriber validation handling
2019-05-07 12:39:56 +01:00
Peter Zimon
bd90585956 Improved theme upload/activate flow and error styles (#1142)
no issue 

* Update error and warning styles
* Refined upload dialog
* Theme upload and activation style refinements
2019-04-05 17:27:14 +01:00
Kevin Ansfield
d0a834b477 🐛 Fixed missing error notification when attempting to activate an invalid theme
no issue
- updates error handling to work with new v2 error response formats
  - `.errorType` -> `.error`
  - `.errorDetails` -> `.details`
2019-03-25 11:32:29 +00:00
Kevin Ansfield
35860fad70 Removed usage of /configuration/timezones/ endpoint
no issue
- replaced timezones endpoint with `@tryghost/timezone-data` module
2019-02-26 12:37:50 +07:00