summaryrefslogtreecommitdiff
path: root/src/services/note/create.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-09-19 14:18:34 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-09-19 14:18:34 +0900
commitd9f0e158a35eec183da77e84a3b038fab645bf62 (patch)
treea7cbad45883ff56d35771d849f95dbd911e3e45c /src/services/note/create.ts
parent8.55.0 (diff)
downloadsharkey-d9f0e158a35eec183da77e84a3b038fab645bf62.tar.gz
sharkey-d9f0e158a35eec183da77e84a3b038fab645bf62.tar.bz2
sharkey-d9f0e158a35eec183da77e84a3b038fab645bf62.zip
Implement #2736
Diffstat (limited to 'src/services/note/create.ts')
-rw-r--r--src/services/note/create.ts22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/services/note/create.ts b/src/services/note/create.ts
index 7c1e71dcb3..b62b8c43ba 100644
--- a/src/services/note/create.ts
+++ b/src/services/note/create.ts
@@ -25,6 +25,7 @@ import { TextElementMention } from '../../mfm/parse/elements/mention';
import { TextElementHashtag } from '../../mfm/parse/elements/hashtag';
import { updateNoteStats } from '../update-chart';
import { erase, unique } from '../../prelude/array';
+import insertNoteUnread from './unread';
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
@@ -170,6 +171,17 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
// Increment notes count (user)
incNotesCountOfUser(user);
+ // 未読通知を作成
+ if (data.visibility == 'specified') {
+ data.visibleUsers.forEach(u => {
+ insertNoteUnread(u, note, true);
+ });
+ } else {
+ mentionedUsers.forEach(u => {
+ insertNoteUnread(u, note, false);
+ });
+ }
+
if (data.reply) {
saveReply(data.reply, note);
}
@@ -314,16 +326,6 @@ async function publish(user: IUser, note: INote, noteObj: any, reply: INote, ren
publishGlobalTimelineStream(noteObj);
}
- if (note.visibility == 'specified') {
- visibleUsers.forEach(async (u) => {
- const n = await pack(note, u, {
- detail: true
- });
- publishUserStream(u._id, 'note', n);
- publishHybridTimelineStream(u._id, n);
- });
- }
-
if (['public', 'home', 'followers'].includes(note.visibility)) {
// フォロワーに配信
publishToFollowers(note, user, noteActivity);