feat: 登録したユーザーがアカウントを削除しても絵文字が消えないように

This commit is contained in:
mai 2024-06-14 14:10:20 +00:00 committed by hijiki
parent 7dde41d3b3
commit 33306c9170

View File

@ -22,6 +22,7 @@ import { ModerationLogService } from '@/core/ModerationLogService.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { DriveService } from './DriveService.js'; import { DriveService } from './DriveService.js';
const parseEmojiStrRegexp = /^([-\w]+)(?:@([\w.-]+))?$/; const parseEmojiStrRegexp = /^([-\w]+)(?:@([\w.-]+))?$/;
@Injectable() @Injectable()
@ -77,6 +78,14 @@ export class CustomEmojiService implements OnApplicationShutdown {
localOnly: boolean; localOnly: boolean;
roleIdsThatCanBeUsedThisEmojiAsReaction: MiRole['id'][]; roleIdsThatCanBeUsedThisEmojiAsReaction: MiRole['id'][];
}, moderator?: MiUser): Promise<MiEmoji> { }, moderator?: MiUser): Promise<MiEmoji> {
// システムユーザーとして再アップロード
if (!data.driveFile.user?.isRoot) {
data.driveFile = await this.driveService.uploadFromUrl({
url: data.driveFile.url,
user: null,
force: true,
});
}
const emoji = await this.emojisRepository.insertOne({ const emoji = await this.emojisRepository.insertOne({
id: this.idService.gen(), id: this.idService.gen(),
updatedAt: new Date(), updatedAt: new Date(),