fix(server): アンテナの作成数上限を追加

This commit is contained in:
syuilo 2022-12-26 08:50:17 +09:00
parent 5e6851ce39
commit c801434d11
2 changed files with 14 additions and 0 deletions

View file

@ -50,6 +50,7 @@ You should also include the user name that made the change.
- Server: Fix peers API returning suspended instances @ineffyble
- Server: trim long text of note from ap @syuilo
- Server: Ap inboxの最大ペイロードサイズを64kbに制限 @syuilo
- Server: アンテナの作成数上限を追加 @syuilo
- Client: case insensitive emoji search @saschanaz
- Client: InAppウィンドウが操作できなくなることがあるのを修正 @tamaina
- Client: use proxied image for instance icon @syuilo

View file

@ -26,6 +26,12 @@ export const meta = {
code: 'NO_SUCH_USER_GROUP',
id: 'aa3c0b9a-8cae-47c0-92ac-202ce5906682',
},
tooManyAntennas: {
message: 'You cannot create antenna any more.',
code: 'TOO_MANY_ANTENNAS',
id: 'faf47050-e8b5-438c-913c-db2b1576fde4',
},
},
res: {
@ -81,6 +87,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
private globalEventService: GlobalEventService,
) {
super(meta, paramDef, async (ps, me) => {
const currentAntennasCount = await this.antennasRepository.countBy({
userId: me.id,
});
if (currentAntennasCount > 5) {
throw new ApiError(meta.errors.tooManyAntennas);
}
let userList;
let userGroupJoining;