pass client token through API via caller ID

This commit is contained in:
Hazelnoot 2025-06-22 15:34:52 -04:00
parent 2e61fafe57
commit df750a6b65
5 changed files with 85 additions and 13 deletions

View file

@ -342,11 +342,11 @@ export class ChatService {
}
@bindThis
public async hasPermissionToViewRoomTimeline(meId: MiUser['id'], room: MiChatRoom) {
if (await this.isRoomMember(room, meId)) {
public async hasPermissionToViewRoomTimeline(me: MiUser, room: MiChatRoom) {
if (await this.isRoomMember(room, me.id)) {
return true;
} else {
const iAmModerator = await this.roleService.isModerator({ id: meId });
const iAmModerator = await this.roleService.isModerator(me);
if (iAmModerator) {
return true;
}
@ -563,12 +563,12 @@ export class ChatService {
}
@bindThis
public async hasPermissionToDeleteRoom(meId: MiUser['id'], room: MiChatRoom) {
if (room.ownerId === meId) {
public async hasPermissionToDeleteRoom(me: MiUser, room: MiChatRoom) {
if (room.ownerId === me.id) {
return true;
}
const iAmModerator = await this.roleService.isModerator({ id: meId });
const iAmModerator = await this.roleService.isModerator(me);
if (iAmModerator) {
return true;
}