mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed email segment selector counts not taking subscription status into account
refs https://github.com/TryGhost/Team/issues/496 refs https://github.com/TryGhost/Team/issues/581 - added ability to pass an enforced filter to the segment count component - used the enforced filter to add `subscribed:true` to segment counts where we're counting the number of members that would receive an email
This commit is contained in:
parent
0caa539330
commit
0642a8b3cc
5 changed files with 16 additions and 2 deletions
|
@ -16,7 +16,9 @@ export default class GhMembersSegmentCountComponent extends Component {
|
|||
*fetchTotalsTask() {
|
||||
this.fetchSegmentTotalTask.perform();
|
||||
|
||||
const members = yield this.store.query('member', {limit: 1});
|
||||
const filter = this.args.enforcedFilter || undefined;
|
||||
|
||||
const members = yield this.store.query('member', {limit: 1, filter});
|
||||
this.total = members.meta.pagination.total;
|
||||
}
|
||||
|
||||
|
@ -26,7 +28,15 @@ export default class GhMembersSegmentCountComponent extends Component {
|
|||
return this.segmentTotal = 0;
|
||||
}
|
||||
|
||||
const members = yield this.store.query('member', {limit: 1, filter: this.args.segment});
|
||||
let filter;
|
||||
|
||||
if (this.args.enforcedFilter) {
|
||||
filter = `${this.args.enforcedFilter}+(${this.args.segment})`;
|
||||
} else {
|
||||
filter = this.args.segment;
|
||||
}
|
||||
|
||||
const members = yield this.store.query('member', {limit: 1, filter});
|
||||
this.segmentTotal = members.meta.pagination.total;
|
||||
this.args.onSegmentCountChange?.(this.segmentTotal);
|
||||
}
|
||||
|
|
|
@ -14,5 +14,6 @@
|
|||
|
||||
<GhMembersSegmentCount
|
||||
@segment={{@segment}}
|
||||
@enforcedFilter={{@enforcedCountFilter}}
|
||||
@onSegmentCountChange={{@onSegmentCountChange}}
|
||||
/>
|
|
@ -44,6 +44,7 @@
|
|||
@onChange={{this.setSendEmailWhenPublished}}
|
||||
@onSegmentCountChange={{this.updateMemberCount}}
|
||||
@renderInPlace={{true}}
|
||||
@enforcedCountFilter="subscribed:true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
@segment={{this.recipientsSegment}}
|
||||
@disabled={{true}}
|
||||
@renderInPlace={{true}}
|
||||
@enforcedCountFilter="subscribed:true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
<GhMembersSegmentSelect
|
||||
@segment={{this.settings.editorDefaultEmailRecipientsFilter}}
|
||||
@onChange={{this.setDefaultEmailRecipientsFilter}}
|
||||
@enforcedCountFilter="subscribed:true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue