enhance: モデレーターがチャットルームの内容を確認・削除できるように

This commit is contained in:
syuilo
2025-03-25 15:51:45 +09:00
parent 304d0eb83b
commit a01ae38a07
12 changed files with 73 additions and 7 deletions

View File

@@ -59,7 +59,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.noSuchRoom);
}
if (!(await this.chatService.isRoomMember(room, me.id))) {
if (!await this.chatService.hasPermissionToViewRoomTimeline(me.id, room)) {
throw new ApiError(meta.errors.noSuchRoom);
}

View File

@@ -42,11 +42,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private chatService: ChatService,
) {
super(meta, paramDef, async (ps, me) => {
const room = await this.chatService.findMyRoomById(me.id, ps.roomId);
const room = await this.chatService.findRoomById(ps.roomId);
if (room == null) {
throw new ApiError(meta.errors.noSuchRoom);
}
await this.chatService.deleteRoom(room);
if (!await this.chatService.hasPermissionToDeleteRoom(me.id, room)) {
throw new ApiError(meta.errors.noSuchRoom);
}
await this.chatService.deleteRoom(room, me);
});
}
}