core: use message.send(from, uids)

This commit is contained in:
undefined committed 2025-06-10 03:59:35 +08:00
1 parent e8b1159cda
commit a973ca2a30
2 files changed
+6 -6

No files matched your search

+4 -4
View File
@@ -234,11 +234,11 @@ export class ContestProblemListHandler extends ContestDetailBaseHandler {
await this.limitRate('add_discussion', 3600, 60); await this.limitRate('add_discussion', 3600, 60);
await contest.addClarification(domainId, tid, this.user._id, content, this.request.ip, subject); await contest.addClarification(domainId, tid, this.user._id, content, this.request.ip, subject);
if (!this.user.own(this.tdoc)) { if (!this.user.own(this.tdoc)) {
await Promise.all([this.tdoc.owner, ...this.tdoc.maintainer].map((uid) => message.send(1, uid, JSON.stringify({ await message.send(1, this.tdoc.maintainer.concat(this.tdoc.owner), JSON.stringify({
message: 'Contest {0} has a new clarification about {1}, please go to contest management to reply.', message: 'Contest {0} has a new clarification about {1}, please go to contest management to reply.',
params: [this.tdoc.title, subject > 0 ? `#${this.tdoc.pids.indexOf(subject) + 1}` : 'the contest'], params: [this.tdoc.title, subject > 0 ? `#${this.tdoc.pids.indexOf(subject) + 1}` : 'the contest'],
url: this.url('contest_manage', { tid }), url: this.url('contest_manage', { tid }),
}), message.FLAG_I18N | message.FLAG_UNREAD))); }), message.FLAG_I18N | message.FLAG_UNREAD);
} }
this.back(); this.back();
} }
@@ -462,11 +462,11 @@ export class ContestManagementHandler extends ContestManagementBaseHandler {
const flag = contest.isOngoing(this.tdoc) ? message.FLAG_ALERT : message.FLAG_UNREAD; const flag = contest.isOngoing(this.tdoc) ? message.FLAG_ALERT : message.FLAG_UNREAD;
await Promise.all([ await Promise.all([
contest.addClarification(domainId, tid, 0, content, this.request.ip, subject), contest.addClarification(domainId, tid, 0, content, this.request.ip, subject),
...uids.map((uid) => message.send(1, uid, JSON.stringify({ message.send(1, uids, JSON.stringify({
message: 'Broadcast message from contest {0}:\n{1}', message: 'Broadcast message from contest {0}:\n{1}',
params: [this.tdoc.title, content], params: [this.tdoc.title, content],
url: this.url('contest_problemlist', { tid }), url: this.url('contest_problemlist', { tid }),
}), flag | message.FLAG_I18N)), }), flag | message.FLAG_I18N),
]); ]);
} }
this.back(); this.back();
+2 -2
View File
@@ -238,7 +238,7 @@ class DiscussionDetailHandler extends DiscussionHandler {
message: 'User {0} mentioned you in {1:link}', message: 'User {0} mentioned you in {1:link}',
params: [this.user.uname, `/d/${domainId}${this.request.path}`], params: [this.user.uname, `/d/${domainId}${this.request.path}`],
}); });
await Promise.all(uids.map((i) => message.send(1, i, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD))); await message.send(1, uids, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD);
const drid = await discussion.addReply(domainId, did, this.user._id, content, this.request.ip); const drid = await discussion.addReply(domainId, did, this.user._id, content, this.request.ip);
this.back({ drid }); this.back({ drid });
} }
@@ -255,7 +255,7 @@ class DiscussionDetailHandler extends DiscussionHandler {
message: 'User {0} mentioned you in {1:link}', message: 'User {0} mentioned you in {1:link}',
params: [this.user.uname, `/d/${domainId}${this.request.path}`], params: [this.user.uname, `/d/${domainId}${this.request.path}`],
}); });
await Promise.all(uids.map((i) => message.send(1, i, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD))); await message.send(1, uids, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD);
await discussion.addTailReply(domainId, drid, this.user._id, content, this.request.ip); await discussion.addTailReply(domainId, drid, this.user._id, content, this.request.ip);
this.back(); this.back();
} }