Fixed bulk unsubscribe

refs https://github.com/TryGhost/Team/issues/1567

- Deletes the newsletter relations instead of setting subscribed to false
- Depends on these changes: https://github.com/TryGhost/Ghost/pull/14610
This commit is contained in:
Simon Backx 2022-04-27 19:03:33 +02:00
parent a49bb037c4
commit f051f9aeeb

View File

@ -587,11 +587,13 @@ module.exports = class MemberRepository {
const memberIds = memberRows.map(row => row.id);
if (data.action === 'unsubscribe') {
return await this._Member.bulkEdit(memberIds, 'members', {
data: {
subscribed: false
}
const memberNewsletterRows = await this._Member.getNewsletterRelations({
memberIds
});
const membersNewsletterIds = memberNewsletterRows.map(row => row.id);
return await this._Member.bulkDestroy(membersNewsletterIds, 'members_newsletters');
}
if (data.action === 'removeLabel') {