mirror of
https://github.com/misskey-dev/misskey
synced 2024-11-28 06:48:42 +09:00
絵文字の名前に@や:が使用できる (#9964)
* fix(#9918)名前の一致でもエラーとするように * 判定を逆に * )の位置間違えてる * カテゴリ分けとかしたときにエラーになる * エラー消し * こういうこと・・・?
This commit is contained in:
parent
3d6aaa7aaa
commit
e152047912
@ -19,6 +19,11 @@ export const meta = {
|
||||
code: 'NO_SUCH_EMOJI',
|
||||
id: '684dec9d-a8c2-4364-9aa8-456c49cb1dc8',
|
||||
},
|
||||
alreadyexistsemoji: {
|
||||
message: 'Emoji already exists',
|
||||
code: 'EMOJI_ALREADY_EXISTS',
|
||||
id: '7180fe9d-1ee3-bff9-647d-fe9896d2ffb8',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
@ -26,7 +31,7 @@ export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', format: 'misskey:id' },
|
||||
name: { type: 'string' },
|
||||
name: { type: 'string', pattern: '^[a-zA-Z0-9_]+$' },
|
||||
category: {
|
||||
type: 'string',
|
||||
nullable: true,
|
||||
@ -57,9 +62,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const emoji = await this.emojisRepository.findOneBy({ id: ps.id });
|
||||
|
||||
const emojiname = await this.emojisRepository.findOneBy({ name: ps.name });
|
||||
if (emoji == null) throw new ApiError(meta.errors.noSuchEmoji);
|
||||
|
||||
if (emojiname != null && emojiname.id !== ps.id) throw new ApiError(meta.errors.alreadyexistsemoji);
|
||||
await this.emojisRepository.update(emoji.id, {
|
||||
updatedAt: new Date(),
|
||||
name: ps.name,
|
||||
|
Loading…
Reference in New Issue
Block a user