This commit is contained in:
syuilo
2018-05-29 01:22:39 +09:00
parent 973b1e42ef
commit ab16fb3a3f
13 changed files with 92 additions and 191 deletions

View File

@ -91,6 +91,13 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
publishMessagingIndexStream(message.recipientId, 'message', messageObj);
publishUserStream(message.recipientId, 'messaging_message', messageObj);
// Update flag
User.update({ _id: recipient._id }, {
$set: {
hasUnreadMessagingMessage: true
}
});
// 3秒経っても(今回作成した)メッセージが既読にならなかったら「未読のメッセージがありますよ」イベントを発行する
setTimeout(async () => {
const freshMessage = await Message.findOne({ _id: message._id }, { isRead: true });