mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Merged v5.42.3 into main
This commit is contained in:
commit
8571011e7d
4 changed files with 29 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ghost-admin",
|
||||
"version": "5.42.2",
|
||||
"version": "5.42.3",
|
||||
"description": "Ember.js admin client for Ghost",
|
||||
"author": "Ghost Foundation",
|
||||
"homepage": "http://ghost.org",
|
||||
|
@ -184,4 +184,4 @@
|
|||
"path-browserify": "1.0.1",
|
||||
"webpack": "5.77.0"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ghost",
|
||||
"version": "5.42.2",
|
||||
"version": "5.42.3",
|
||||
"description": "The professional publishing platform",
|
||||
"author": "Ghost Foundation",
|
||||
"homepage": "https://ghost.org",
|
||||
|
|
|
@ -129,7 +129,11 @@ class EmailEventStorage {
|
|||
}
|
||||
|
||||
async unsubscribeFromNewsletters(event) {
|
||||
await this.#membersRepository.update({newsletters: []}, {id: event.memberId});
|
||||
try {
|
||||
await this.#membersRepository.update({newsletters: []}, {id: event.memberId});
|
||||
} catch (err) {
|
||||
logging.error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -466,6 +466,27 @@ describe('Email Event Storage', function () {
|
|||
assert(update.firstCall.args[0].newsletters.length === 0);
|
||||
});
|
||||
|
||||
it('Handles unsubscribe with a non-existent member', async function () {
|
||||
const event = EmailUnsubscribedEvent.create({
|
||||
email: 'example@example.com',
|
||||
memberId: '123',
|
||||
emailId: '456',
|
||||
timestamp: new Date(0)
|
||||
});
|
||||
|
||||
const error = new Error('Member not found');
|
||||
const update = sinon.stub().throws(error);
|
||||
|
||||
const eventHandler = new EmailEventStorage({
|
||||
membersRepository: {
|
||||
update
|
||||
}
|
||||
});
|
||||
await eventHandler.handleUnsubscribed(event);
|
||||
assert(update.calledOnce);
|
||||
assert(update.firstCall.args[0].newsletters.length === 0);
|
||||
});
|
||||
|
||||
it('Handles complaints', async function () {
|
||||
const event = SpamComplaintEvent.create({
|
||||
email: 'example@example.com',
|
||||
|
|
Loading…
Add table
Reference in a new issue