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() {
|
*fetchTotalsTask() {
|
||||||
this.fetchSegmentTotalTask.perform();
|
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;
|
this.total = members.meta.pagination.total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +28,15 @@ export default class GhMembersSegmentCountComponent extends Component {
|
||||||
return this.segmentTotal = 0;
|
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.segmentTotal = members.meta.pagination.total;
|
||||||
this.args.onSegmentCountChange?.(this.segmentTotal);
|
this.args.onSegmentCountChange?.(this.segmentTotal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,6 @@
|
||||||
|
|
||||||
<GhMembersSegmentCount
|
<GhMembersSegmentCount
|
||||||
@segment={{@segment}}
|
@segment={{@segment}}
|
||||||
|
@enforcedFilter={{@enforcedCountFilter}}
|
||||||
@onSegmentCountChange={{@onSegmentCountChange}}
|
@onSegmentCountChange={{@onSegmentCountChange}}
|
||||||
/>
|
/>
|
|
@ -44,6 +44,7 @@
|
||||||
@onChange={{this.setSendEmailWhenPublished}}
|
@onChange={{this.setSendEmailWhenPublished}}
|
||||||
@onSegmentCountChange={{this.updateMemberCount}}
|
@onSegmentCountChange={{this.updateMemberCount}}
|
||||||
@renderInPlace={{true}}
|
@renderInPlace={{true}}
|
||||||
|
@enforcedCountFilter="subscribed:true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
@segment={{this.recipientsSegment}}
|
@segment={{this.recipientsSegment}}
|
||||||
@disabled={{true}}
|
@disabled={{true}}
|
||||||
@renderInPlace={{true}}
|
@renderInPlace={{true}}
|
||||||
|
@enforcedCountFilter="subscribed:true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
<GhMembersSegmentSelect
|
<GhMembersSegmentSelect
|
||||||
@segment={{this.settings.editorDefaultEmailRecipientsFilter}}
|
@segment={{this.settings.editorDefaultEmailRecipientsFilter}}
|
||||||
@onChange={{this.setDefaultEmailRecipientsFilter}}
|
@onChange={{this.setDefaultEmailRecipientsFilter}}
|
||||||
|
@enforcedCountFilter="subscribed:true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue