From f014b7ae0ece886ef0cff2366b9925e23b34ba6f Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Tue, 5 Feb 2019 03:01:36 +0900 Subject: アニメーションを自動再生しないオプション (#4131) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Refactor * settings * Media Proxy * Replace API response --- src/models/note.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/models/note.ts') diff --git a/src/models/note.ts b/src/models/note.ts index 352de4f8d6..b1031d3e9b 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -11,6 +11,7 @@ import Reaction from './note-reaction'; import { packMany as packFileMany, IDriveFile } from './drive-file'; import Following from './following'; import Emoji from './emoji'; +import wrapUrl from '../misc/wrap-url'; const Note = db.get('notes'); Note.createIndex('uri', { sparse: true, unique: true }); @@ -247,11 +248,14 @@ export const pack = async ( fields: { _id: false } }); } else { - _note.emojis = Emoji.find({ + _note.emojis = (await Emoji.find({ name: { $in: _note.emojis }, host: host }, { fields: { _id: false } + })).map(emoji => async () => { + emoji.url = await wrapUrl(emoji.url, me); + return emoji; }); } } @@ -274,7 +278,7 @@ export const pack = async ( if (_note.geo) delete _note.geo.type; // Populate user - _note.user = packUser(_note.userId, meId); + _note.user = packUser(_note.userId, me); // Populate app if (_note.appId) { @@ -282,7 +286,7 @@ export const pack = async ( } // Populate files - _note.files = packFileMany(_note.fileIds || []); + _note.files = packFileMany(_note.fileIds || [], { me }); // Some counts _note.renoteCount = _note.renoteCount || 0; -- cgit v1.2.3-freya