diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2019-02-05 03:01:36 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2019-02-05 03:01:36 +0900 |
| commit | f014b7ae0ece886ef0cff2366b9925e23b34ba6f (patch) | |
| tree | c35760467278da408348fcd459415af7a63e08e9 /src/models/note.ts | |
| parent | Refactor: Better type definition (diff) | |
| download | sharkey-f014b7ae0ece886ef0cff2366b9925e23b34ba6f.tar.gz sharkey-f014b7ae0ece886ef0cff2366b9925e23b34ba6f.tar.bz2 sharkey-f014b7ae0ece886ef0cff2366b9925e23b34ba6f.zip | |
アニメーションを自動再生しないオプション (#4131)
* Refactor
* settings
* Media Proxy
* Replace API response
Diffstat (limited to 'src/models/note.ts')
| -rw-r--r-- | src/models/note.ts | 10 |
1 files changed, 7 insertions, 3 deletions
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<INote>('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; |