From d97fc9ce4ea19466fd77428724ffcab6fe001966 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 23 Jun 2021 13:42:02 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AB=E3=82=B9=E3=82=BF=E3=83=A0=E7=B5=B5?= =?UTF-8?q?=E6=96=87=E5=AD=97=E3=82=A4=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=88?= =?UTF-8?q?=E6=99=82=E3=82=82emojiAdded=E3=82=A4=E3=83=99=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E7=99=BA=E8=A1=8C=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/endpoints/admin/emoji/copy.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/server/api/endpoints/admin/emoji/copy.ts b/src/server/api/endpoints/admin/emoji/copy.ts index 1a784f4061..72c2b014a4 100644 --- a/src/server/api/endpoints/admin/emoji/copy.ts +++ b/src/server/api/endpoints/admin/emoji/copy.ts @@ -7,6 +7,7 @@ import { ApiError } from '../../../error'; import { DriveFile } from '../../../../../models/entities/drive-file'; import { ID } from '@/misc/cafy-id'; import uploadFromUrl from '../../../../../services/drive/upload-from-url'; +import { publishBroadcastStream } from '@/services/stream'; export const meta = { tags: ['admin'], @@ -57,7 +58,7 @@ export default define(meta, async (ps, me) => { throw new ApiError(); } - const copied = await Emojis.save({ + const copied = await Emojis.insert({ id: genId(), updatedAt: new Date(), name: emoji.name, @@ -66,10 +67,14 @@ export default define(meta, async (ps, me) => { url: driveFile.url, type: driveFile.type, fileId: driveFile.id, - }); + }).then(x => Emojis.findOneOrFail(x.identifiers[0])); await getConnection().queryResultCache!.remove(['meta_emojis']); + publishBroadcastStream('emojiAdded', { + emoji: await Emojis.pack(copied.id) + }); + return { id: copied.id };