From d95eb495ead0d3cf453269c9c12a82df0b012602 Mon Sep 17 00:00:00 2001 From: undefined Date: Mon, 30 Sep 2024 22:27:05 +0800 Subject: [PATCH] core: await message.send in discussion --- packages/hydrooj/src/handler/discussion.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/hydrooj/src/handler/discussion.ts b/packages/hydrooj/src/handler/discussion.ts index dcbd07178..4a740eef0 100644 --- a/packages/hydrooj/src/handler/discussion.ts +++ b/packages/hydrooj/src/handler/discussion.ts @@ -238,9 +238,7 @@ class DiscussionDetailHandler extends DiscussionHandler { message: 'User {0} mentioned you in {1:link}', params: [this.user.uname, `/d/${domainId}${this.request.path}`], }); - for (const uid of uids) { - message.send(1, uid, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD); - } + await Promise.all(uids.map((i) => message.send(1, i, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD))); const drid = await discussion.addReply(domainId, did, this.user._id, content, this.request.ip); this.back({ drid }); } @@ -257,9 +255,7 @@ class DiscussionDetailHandler extends DiscussionHandler { message: 'User {0} mentioned you in {1:link}', params: [this.user.uname, `/d/${domainId}${this.request.path}`], }); - for (const uid of uids) { - message.send(1, uid, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD); - } + await Promise.all(uids.map((i) => message.send(1, i, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD))); await discussion.addTailReply(domainId, drid, this.user._id, content, this.request.ip); this.back(); }