Commit Graph

7 Commits

Author SHA1 Message Date
Kevin Ansfield 25f4694d06
Switched to a minimal form when creating a newsletter (#2356)
no issue

The full edit newsletter form with all the settings, design options, and preview felt quite overwhelming when the only piece of data that's required to create a newsletter is the name.

- re-organised the newsletter modal components by renaming `modals/edit-newlsetter` to `modals/newsletters` to better represent the full suite of modals that are used in newsletter management
- added a `modals/newsletters/new` component containing a minimal form with name/description/opt-in-existing fields
- switched the `new-newsletter` route to open the new modal rather than the previous dual-purpose edit modal
- moved message about newsletter creation into the create modal and dropped the separate create confirmation modal
- dropped unnecessary unsaved-changes confirmation
- removed the now-unused opt-in-existing behaviour from the edit newsletter modal

Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2022-04-27 10:36:43 +01:00
Kevin Ansfield eb8f0cf5eb Added confirmation dialog when unarchiving a newsletter
closes https://github.com/TryGhost/Team/issues/1540
refs 3e51df1ca3

- follows same pattern as archiving
2022-04-20 13:15:45 +01:00
Kevin Ansfield 5716d7a1d7 Fixed create newsletter confirmation showing when editing existing newsletter
closes https://github.com/TryGhost/Team/issues/1537

- added conditional around the create confirmation modal display so it's only shown when attempting to save a new newsletter record
2022-04-20 12:52:20 +01:00
Kevin Ansfield 27ac00fc4e Added auto-subscribe newsletter count when confirming newsletter creation
refs https://github.com/TryGhost/Team/issues/1528

- used the already-loaded newsletters list to pass the slugs of active newsletters to the confirm modal, this allows use of the `{{members-count-fetcher}}` resource with the query `/members/?filter=newsletters:[...slugs]` to fetch a member and full count metadata
- added inclusion of `{{join}}` helper from `ember-composable-helpers` addon
2022-04-19 21:56:13 +01:00
Kevin Ansfield b377927d26 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 07d48c6497 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 1b7769b5d0 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