カスタム絵文字インポート時もemojiAddedイベントを発行するように
This commit is contained in:
parent
f26aeee819
commit
d97fc9ce4e
|
@ -7,6 +7,7 @@ import { ApiError } from '../../../error';
|
||||||
import { DriveFile } from '../../../../../models/entities/drive-file';
|
import { DriveFile } from '../../../../../models/entities/drive-file';
|
||||||
import { ID } from '@/misc/cafy-id';
|
import { ID } from '@/misc/cafy-id';
|
||||||
import uploadFromUrl from '../../../../../services/drive/upload-from-url';
|
import uploadFromUrl from '../../../../../services/drive/upload-from-url';
|
||||||
|
import { publishBroadcastStream } from '@/services/stream';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['admin'],
|
tags: ['admin'],
|
||||||
|
@ -57,7 +58,7 @@ export default define(meta, async (ps, me) => {
|
||||||
throw new ApiError();
|
throw new ApiError();
|
||||||
}
|
}
|
||||||
|
|
||||||
const copied = await Emojis.save({
|
const copied = await Emojis.insert({
|
||||||
id: genId(),
|
id: genId(),
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
name: emoji.name,
|
name: emoji.name,
|
||||||
|
@ -66,10 +67,14 @@ export default define(meta, async (ps, me) => {
|
||||||
url: driveFile.url,
|
url: driveFile.url,
|
||||||
type: driveFile.type,
|
type: driveFile.type,
|
||||||
fileId: driveFile.id,
|
fileId: driveFile.id,
|
||||||
});
|
}).then(x => Emojis.findOneOrFail(x.identifiers[0]));
|
||||||
|
|
||||||
await getConnection().queryResultCache!.remove(['meta_emojis']);
|
await getConnection().queryResultCache!.remove(['meta_emojis']);
|
||||||
|
|
||||||
|
publishBroadcastStream('emojiAdded', {
|
||||||
|
emoji: await Emojis.pack(copied.id)
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: copied.id
|
id: copied.id
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue