From 6df010a71e4be1ee819c0c2730334a6c0f5b4387 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 29 Apr 2018 04:51:19 +0900 Subject: [PATCH] wip --- src/models/note.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/models/note.ts b/src/models/note.ts index 5c4ac8635..918ef6d69 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -262,7 +262,7 @@ export const pack = async ( } // Populate media - if (_note.mediaIds) { + if (_note.mediaIds && !hide) { _note.media = Promise.all(_note.mediaIds.map(fileId => packFile(fileId) )); @@ -321,7 +321,7 @@ export const pack = async ( } // Poll - if (meId && _note.poll) { + if (meId && _note.poll && !hide) { _note.poll = (async (poll) => { const vote = await PollVote .findOne({ @@ -362,5 +362,12 @@ export const pack = async ( // resolve promises in _note object _note = await rap(_note); + if (hide) { + _note.mediaIds = []; + _note.text = null; + _note.poll = null; + _note.isHidden = true; + } + return _note; };