mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Fixed subscribe count on adding new newsletter (#2402)
refs https://github.com/TryGhost/Team/issues/1634 - member count on newsletter may not be immediately updated on saving newsletter - api returns `opted_in_member_count` in response to adding newsletter which admin cannot use atm - re-fetches newsletters on save so all newsletters get updated member and post counts
This commit is contained in:
parent
857a8e5ae0
commit
1dc3026aba
1 changed files with 4 additions and 1 deletions
|
@ -6,6 +6,7 @@ import {tracked} from '@glimmer/tracking';
|
|||
|
||||
export default class NewNewsletterModal extends Component {
|
||||
@service modals;
|
||||
@service store;
|
||||
|
||||
@tracked optInExisting = this.args.data.newsletter.isNew;
|
||||
|
||||
|
@ -44,9 +45,11 @@ export default class NewNewsletterModal extends Component {
|
|||
yield newsletter.validate({});
|
||||
|
||||
const result = yield newsletter.save({
|
||||
adapterOptions: {optInExisting: this.optInExisting, include: 'count.members,count.posts'}
|
||||
adapterOptions: {optInExisting: this.optInExisting}
|
||||
});
|
||||
|
||||
// Re-fetch newsletter data to refresh counts
|
||||
yield this.store.query('newsletter', {include: 'count.members,count.posts', limit: 'all'});
|
||||
this.args.data.afterSave?.(result);
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Add table
Reference in a new issue