Ghost/ghost/admin/app/components/modal-delete-members.hbs
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

66 lines
2.6 KiB
Handlebars

<header class="modal-header" data-test-modal="delete-members">
<h1>Delete selected members?</h1>
</header>
<a class="close" href="" role="button" title="Close" {{action "closeModal"}}>{{svg-jar "close"}}<span class="hidden">Close</span></a>
{{#if (not this.confirmed)}}
<div class="modal-body" data-test-state="delete-unconfirmed">
<p>
You're about to delete
<strong data-test-text="delete-count">{{gh-pluralize this.model.memberCount "member"}}</strong>.
This is permanent! All Ghost data will be deleted, this will have no effect on subscriptions in Stripe.
</p>
</div>
{{else}}
<div class="modal-body bg-whitegray-l2 ba b--whitegrey br3 pa4" data-test-state="delete-complete">
{{#if this.error}}
<div class="flex items-center">
{{svg-jar "warning" class="w4 h4 fill-red mr2 nudge-top--3"}}
<div>
<p class="ma0 pa0">
<span class="fw5" data-test-text="delete-error">{{this.error}}</span>
</p>
</div>
</div>
{{else}}
<div class="flex items-center">
{{svg-jar "check-circle" class="w4 h4 stroke-green mr2"}}
<p class="ma0 pa0">
<span class="fw6" data-test-text="deleted-count">{{gh-pluralize this.response.stats.successful "member"}}</span>
deleted
</p>
</div>
{{#if this.response.stats.unsuccessful}}
<div class="flex items-start mt2" data-test-bulk-delete-errors>
{{svg-jar "warning" class="w4 h4 fill-red mr2 nudge-top--3"}}
<div>
<p class="ma0 pa0">
<span class="fw5" data-test-text="invalid-count">{{gh-pluralize this.response.stats.unsuccessful "member"}}</span>
failed to delete
</p>
</div>
</div>
{{/if}}
{{/if}}
</div>
{{/if}}
<div class="modal-footer">
{{#if (not this.confirmed)}}
<button {{action "closeModal"}} class="gh-btn" data-test-button="cancel">
<span>Cancel</span>
</button>
<GhTaskButton
@buttonText="Delete members"
@successText="Deleted"
@task={{this.deleteMembersTask}}
@class="gh-btn gh-btn-red gh-btn-icon"
data-test-button="confirm"
/>
{{else}}
<button {{action "closeModal"}} class="gh-btn" data-test-button="close-modal">
<span>Close</span>
</button>
{{/if}}
</div>