diff --git a/src/models/note.ts b/src/models/note.ts index 359d953735..3bbfec0103 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -289,7 +289,7 @@ export const pack = async ( // Poll if (meId && _note.poll && !hide) { - _note.poll = (async (poll) => { + _note.poll = (async poll => { const vote = await PollVote .findOne({ userId: meId, diff --git a/src/server/api/stream/home.ts b/src/server/api/stream/home.ts index 54fde2d776..d9b8f7fb96 100644 --- a/src/server/api/stream/home.ts +++ b/src/server/api/stream/home.ts @@ -4,7 +4,7 @@ import * as debug from 'debug'; import User, { IUser } from '../../../models/user'; import Mute from '../../../models/mute'; -import { pack as packNote } from '../../../models/note'; +import { pack as packNote, pack } from '../../../models/note'; import readNotification from '../common/read-notification'; import call from '../call'; import { IApp } from '../../../models/app'; @@ -48,6 +48,14 @@ 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 + }); + data = JSON.stringify(x); + } + connection.send(data); } catch (e) { connection.send(data); diff --git a/src/server/api/stream/local-timeline.ts b/src/server/api/stream/local-timeline.ts index a790ba878b..8f6a445be0 100644 --- a/src/server/api/stream/local-timeline.ts +++ b/src/server/api/stream/local-timeline.ts @@ -3,6 +3,7 @@ import * as redis from 'redis'; import { IUser } from '../../../models/user'; import Mute from '../../../models/mute'; +import { pack } from '../../../models/note'; export default async function( request: websocket.request, @@ -31,6 +32,13 @@ 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