Commit Graph

3 Commits

Author SHA1 Message Date
Kevin Ansfield
6c079daafa Improved handling of missing member counts in publish flow
no issue

Only Admins/Owners can browse members to get member counts but Editors/Authors are allowed to send email. This means we need to account for the count figures being missing.

- added guard to the total member count fetch in `PublishOptions`
  - guard needed because the failed API request would abort setup
  - when the current user isn't an admin, set the total member count to 1 to avoid email options being disabled
- added guard in the `{{members-count-fetcher}}` resource so we're not triggering API errors and the count is kept as `null` so it's handled automatically if passed to `{{gh-pluralize}}`
- updated `<GhMembersRecipientSelect>` to not show counts (or the surrounding `()`) when the count is `null`
2022-05-11 18:56:29 +01:00
Kevin Ansfield
7c4674507e Switched members-count-fetcher to use members-count-cache
no issue

In the new publish flow we use `{{members-count-fetcher}}` to show member counts as needed in the template without needing to worry about manually fetching counts in the backing classes. However, when switching between states in the flow the count would be re-requested resulting in some glitchy looking async count rendering. By changing `{{members-count-fetcher}}` to use our `members-count-cache` service internally we reduce the likelihood of an async count being triggered when switching between publish flow states.

- updated `members-count-cache` service methods to work with filter strings or full query objects
- switched `members-count-fetcher` resource to use `members-count-cache` in place of directly querying the store
2022-05-05 11:18:49 +01:00
Kevin Ansfield
24b222e927 Refactored modal for bulk adding a label to members
refs https://github.com/TryGhost/Team/issues/559

Members controller was becoming bloated and difficult to follow due to catering for many different concerns.

- converted old modal to newer promise-modal style
- pulled full label-adding logic out of the members controller and into the modal so logic is contained in one place
- added `{{members-count-fetcher}}` resource that allows for member counts to be fetched directly from templates avoiding duplicated code
2022-02-09 21:58:59 +00:00