絵文字重複チェック (#11941)

* 絵文字重複チェック

* アップデート時のチェック

* Update packages/backend/src/core/CustomEmojiService.ts

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>

* Update packages/backend/src/server/api/endpoints/admin/emoji/add.ts

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>

* Update packages/backend/src/server/api/endpoints/admin/emoji/update.ts

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
nenohi
2023-10-06 21:05:44 +09:00
committed by GitHub
parent 691fe711ff
commit 11e657bdd7
3 changed files with 30 additions and 0 deletions

View File

@@ -380,6 +380,20 @@ export class CustomEmojiService implements OnApplicationShutdown {
}
}
/**
* ローカル内の絵文字に重複がないかチェックします
* @param name 絵文字名
*/
@bindThis
public checkDuplicate(name: string): Promise<boolean> {
return this.emojisRepository.exist({ where: { name, host: IsNull() } });
}
@bindThis
public getEmojiById(id: string): Promise<MiEmoji | null> {
return this.emojisRepository.findOneBy({ id });
}
@bindThis
public dispose(): void {
this.cache.dispose();