backend: use customEmojiService for copying emoji
This commit is contained in:
parent
bdaabf5abe
commit
e500b67b0b
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue