From b2e00221e1d3ceb0040423be7e92a4621635440c Mon Sep 17 00:00:00 2001 From: Simon Backx Date: Tue, 7 Mar 2023 11:24:02 +0100 Subject: [PATCH] Fixed MentionSendingService listening to events multiple times in tests no issue --- ghost/core/core/server/services/mentions/service.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ghost/core/core/server/services/mentions/service.js b/ghost/core/core/server/services/mentions/service.js index 703b1be896..fdc41d4e13 100644 --- a/ghost/core/core/server/services/mentions/service.js +++ b/ghost/core/core/server/services/mentions/service.js @@ -26,7 +26,12 @@ function getPostUrl(post) { module.exports = { controller: new MentionController(), + didInit: false, async init() { + if (this.didInit) { + return; + } + this.didInit = true; const repository = new BookshelfMentionRepository({ MentionModel: models.Mention, DomainEvents @@ -97,6 +102,6 @@ module.exports = { } } }); - sendingService.listen(events); + sendingService.listen(events); } };