feat: refine announcement (misskey-dev#11497)

This commit is contained in:
まっちゃとーにゅ 2023-08-18 08:03:03 +09:00
parent 576251200f
commit d14137f0ea
No known key found for this signature in database
GPG key ID: 6AFBBF529601C1DB
37 changed files with 1223 additions and 222 deletions

View file

@ -31,8 +31,13 @@ export const paramDef = {
title: { type: 'string', minLength: 1 },
text: { type: 'string', minLength: 1 },
imageUrl: { type: 'string', nullable: true, minLength: 0 },
icon: { type: 'string', enum: ['info', 'warning', 'error', 'success'] },
display: { type: 'string', enum: ['normal', 'banner', 'dialog'] },
forExistingUsers: { type: 'boolean' },
needConfirmationToRead: { type: 'boolean' },
isActive: { type: 'boolean' },
},
required: ['id', 'title', 'text', 'imageUrl'],
required: ['id'],
} as const;
// eslint-disable-next-line import/no-default-export
@ -53,6 +58,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
text: ps.text,
/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- 空の文字列の場合、nullを渡すようにするため */
imageUrl: ps.imageUrl || null,
display: ps.display,
icon: ps.icon,
forExistingUsers: ps.forExistingUsers,
needConfirmationToRead: ps.needConfirmationToRead,
isActive: ps.isActive,
});
});
}