From 1fea2cdcbe341bb56be1cd2b79a8115b482fab65 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 11 Sep 2018 20:57:25 +0900 Subject: [PATCH] Fix bug --- src/server/api/stream/home.ts | 14 +++++++------- src/server/api/stream/hybrid-timeline.ts | 14 +++++++------- src/server/api/stream/local-timeline.ts | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/server/api/stream/home.ts b/src/server/api/stream/home.ts index dc3ce9d19..5f3b6744b 100644 --- a/src/server/api/stream/home.ts +++ b/src/server/api/stream/home.ts @@ -36,6 +36,13 @@ export default async function( // Subscribe Home stream channel subscriber.on(`user-stream:${user._id}`, async x => { + // Renoteなら再pack + if (x.type == 'note' && x.body.renoteId != null) { + x.body.renote = await pack(x.body.renoteId, user, { + detail: true + }); + } + //#region 流れてきたメッセージがミュートしているユーザーが関わるものだったら無視する if (x.type == 'note') { if (mutedUserIds.includes(x.body.userId)) { @@ -54,13 +61,6 @@ export default async function( } //#endregion - // Renoteなら再pack - if (x.type == 'note' && x.body.renoteId != null) { - x.body.renote = await pack(x.body.renoteId, user, { - detail: true - }); - } - connection.send(JSON.stringify(x)); }); diff --git a/src/server/api/stream/hybrid-timeline.ts b/src/server/api/stream/hybrid-timeline.ts index c401145ab..d0dae9b0d 100644 --- a/src/server/api/stream/hybrid-timeline.ts +++ b/src/server/api/stream/hybrid-timeline.ts @@ -19,6 +19,13 @@ export default async function( subscriber.on(`hybrid-timeline:${user._id}`, onEvent); async function onEvent(note: any) { + // Renoteなら再pack + if (note.renoteId != null) { + note.renote = await pack(note.renoteId, user, { + detail: true + }); + } + //#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する if (mutedUserIds.indexOf(note.userId) != -1) { return; @@ -31,13 +38,6 @@ export default async function( } //#endregion - // Renoteなら再pack - if (note.renoteId != null) { - note.renote = await pack(note.renoteId, user, { - detail: true - }); - } - connection.send(JSON.stringify({ type: 'note', body: note diff --git a/src/server/api/stream/local-timeline.ts b/src/server/api/stream/local-timeline.ts index 25e0e00c9..e21c071ba 100644 --- a/src/server/api/stream/local-timeline.ts +++ b/src/server/api/stream/local-timeline.ts @@ -16,6 +16,13 @@ export default async function( // Subscribe stream subscriber.on('local-timeline', async note => { + // Renoteなら再pack + if (note.renoteId != null) { + note.renote = await pack(note.renoteId, user, { + detail: true + }); + } + //#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する if (mutedUserIds.indexOf(note.userId) != -1) { return; @@ -28,13 +35,6 @@ export default async function( } //#endregion - // Renoteなら再pack - if (note.renoteId != null) { - note.renote = await pack(note.renoteId, user, { - detail: true - }); - } - connection.send(JSON.stringify({ type: 'note', body: note