mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix message send when no rcpts
This commit is contained in:
1 file changed
+1
@@ -26,6 +26,7 @@ class MessageModel {
|
|||||||
const base = {
|
const base = {
|
||||||
_id, from, content, flag,
|
_id, from, content, flag,
|
||||||
};
|
};
|
||||||
|
if (!to.length) return base;
|
||||||
await MessageModel.coll.insertMany(to.map((t) => ({ ...base, to: t })));
|
await MessageModel.coll.insertMany(to.map((t) => ({ ...base, to: t })));
|
||||||
bus.broadcast('user/message', to, base);
|
bus.broadcast('user/message', to, base);
|
||||||
if (flag & MessageModel.FLAG_UNREAD) await user.inc(to, 'unreadMsg', 1);
|
if (flag & MessageModel.FLAG_UNREAD) await user.inc(to, 'unreadMsg', 1);
|
||||||
|
|||||||
Reference in new issue
Block a user