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(); }