forked from mirrors/misskey
This commit is contained in:
@@ -3,6 +3,7 @@ import Notification from '../models/notification';
|
||||
import Mute from '../models/mute';
|
||||
import { pack } from '../models/notification';
|
||||
import stream from './stream';
|
||||
import User from '../models/user';
|
||||
|
||||
export default (
|
||||
notifiee: mongo.ObjectID,
|
||||
@@ -29,6 +30,13 @@ export default (
|
||||
stream(notifiee, 'notification',
|
||||
await pack(notification));
|
||||
|
||||
// Update flag
|
||||
User.update({ _id: notifiee }, {
|
||||
$set: {
|
||||
hasUnreadNotification: true
|
||||
}
|
||||
});
|
||||
|
||||
// 3秒経っても(今回作成した)通知が既読にならなかったら「未読の通知がありますよ」イベントを発行する
|
||||
setTimeout(async () => {
|
||||
const fresh = await Notification.findOne({ _id: notification._id }, { isRead: true });
|
||||
|
||||
Reference in New Issue
Block a user