backend: use customEmojiService for copying emoji

This commit is contained in:
ltlapy 2023-02-19 01:00:07 +09:00
parent bdaabf5abe
commit e500b67b0b

View file

@ -78,21 +78,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
throw new ApiError();
}
const copied = await this.emojisRepository.insert({
id: this.idService.genId(),
updatedAt: new Date(),
const copied = await this.customEmojiService.add({
name: emoji.name,
category: null,
host: null,
aliases: [],
originalUrl: driveFile.url,
publicUrl: driveFile.webpublicUrl ?? driveFile.url,
type: driveFile.webpublicType ?? driveFile.type,
}).then(x => this.emojisRepository.findOneByOrFail(x.identifiers[0]));
await this.db.queryResultCache!.remove(['meta_emojis']);
this.globalEventService.publishBroadcastStream('emojiAdded', {
emoji: await this.emojiEntityService.packDetailed(copied.id),
driveFile,
});
return {