enhance: モデレーターがチャットルームの内容を確認・削除できるように
This commit is contained in:
parent
304d0eb83b
commit
a01ae38a07
12 changed files with 73 additions and 7 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue