Merge tag '2023.10.0' into merge-upstream

This commit is contained in:
riku6460 2023-10-10 21:22:31 +09:00
commit 5593eab248
No known key found for this signature in database
GPG key ID: 27414FA27DB94CF6
226 changed files with 5462 additions and 2914 deletions

View file

@ -48,7 +48,6 @@ export class CustomEmojiService implements OnApplicationShutdown {
fetcher: () => this.emojisRepository.find({ where: { host: IsNull() } }).then(emojis => new Map(emojis.map(emoji => [emoji.name, emoji]))),
toRedisConverter: (value) => JSON.stringify(Array.from(value.values())),
fromRedisConverter: (value) => {
if (!Array.isArray(JSON.parse(value))) return undefined; // 古いバージョンの壊れたキャッシュが残っていることがある(そのうち消す)
return new Map(JSON.parse(value).map((x: Serialized<MiEmoji>) => [x.name, {
...x,
updatedAt: x.updatedAt ? new Date(x.updatedAt) : null,
@ -384,6 +383,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();