アニメーション画像を無効にする際、サーバーサイドではなくクライアントサイドでURLを変更するように

This commit is contained in:
syuilo
2019-02-05 03:51:54 +09:00
parent f014b7ae0e
commit 861302f0fd
14 changed files with 40 additions and 56 deletions

View File

@ -11,7 +11,6 @@ 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 });
@ -248,14 +247,11 @@ export const pack = async (
fields: { _id: false }
});
} else {
_note.emojis = (await Emoji.find({
_note.emojis = Emoji.find({
name: { $in: _note.emojis },
host: host
}, {
fields: { _id: false }
})).map(emoji => async () => {
emoji.url = await wrapUrl(emoji.url, me);
return emoji;
});
}
}
@ -278,7 +274,7 @@ export const pack = async (
if (_note.geo) delete _note.geo.type;
// Populate user
_note.user = packUser(_note.userId, me);
_note.user = packUser(_note.userId, meId);
// Populate app
if (_note.appId) {
@ -286,7 +282,7 @@ export const pack = async (
}
// Populate files
_note.files = packFileMany(_note.fileIds || [], { me });
_note.files = packFileMany(_note.fileIds || []);
// Some counts
_note.renoteCount = _note.renoteCount || 0;