" -> '
This commit is contained in:
parent
f965b35a2c
commit
70bb365cd1
|
@ -115,20 +115,20 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
|||
roleIdsThatCanBeUsedThisEmojiAsReaction?: MiRole['id'][];
|
||||
}, moderator?: MiUser): Promise<
|
||||
void
|
||||
| "NO_SUCH_EMOJI"
|
||||
| "SAME_NAME_EMOJI_EXISTS"
|
||||
| 'NO_SUCH_EMOJI'
|
||||
| 'SAME_NAME_EMOJI_EXISTS'
|
||||
> {
|
||||
const emoji = data.id
|
||||
? await this.getEmojiById(data.id)
|
||||
: await this.getEmojiByName(data.name!);
|
||||
if (emoji === null) return "NO_SUCH_EMOJI";
|
||||
if (emoji === null) return 'NO_SUCH_EMOJI';
|
||||
const id = emoji.id;
|
||||
|
||||
// IDと絵文字名が両方指定されている場合は絵文字名の変更を行うため重複チェックが必要
|
||||
const doNameUpdate = data.id && data.name && (data.name !== emoji.name);
|
||||
if (doNameUpdate) {
|
||||
const isDuplicate = await this.checkDuplicate(data.name!);
|
||||
if (isDuplicate) return "SAME_NAME_EMOJI_EXISTS";
|
||||
if (isDuplicate) return 'SAME_NAME_EMOJI_EXISTS';
|
||||
}
|
||||
|
||||
await this.emojisRepository.update(emoji.id, {
|
||||
|
|
|
@ -96,8 +96,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
switch (error) {
|
||||
case undefined: return;
|
||||
case "NO_SUCH_EMOJI": throw new ApiError(meta.errors.noSuchEmoji);
|
||||
case "SAME_NAME_EMOJI_EXISTS": throw new ApiError(meta.errors.sameNameEmojiExists);
|
||||
case 'NO_SUCH_EMOJI': throw new ApiError(meta.errors.noSuchEmoji);
|
||||
case 'SAME_NAME_EMOJI_EXISTS': throw new ApiError(meta.errors.sameNameEmojiExists);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue