Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/modules/data/room/roomMembers/RoomMembers.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ export const useRoomMembersStore = defineStore("roomMembersStore", () => {
addMembers,
isRoomOwner,
changeRoomOwner,
currentUserId,
confirmInvitations,
fetchMembers,
resetPotentialMembers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ withDefaults(defineProps<Props>(), {

const { t } = useI18n();
const roomMembersStore = useRoomMembersStore();
const { roomMembersWithoutApplicants, roomMembersForAdmins, selectedIds, baseTableHeaders } =
const { currentUserId, roomMembersWithoutApplicants, roomMembersForAdmins, selectedIds, baseTableHeaders } =
storeToRefs(roomMembersStore);
const { isRoomOwner, removeMembers, fetchMembers } = roomMembersStore;
const { askConfirmation } = useConfirmationDialog();
Expand Down Expand Up @@ -163,6 +163,11 @@ const canRemoveMember = (item: RoomMember | string[]) => {
const members = membersByIds(item);
return members.every(canRemoveMember);
}

if (currentUserId.value && isRoomOwner(currentUserId.value)) {
return !isRoomOwner(item.userId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there can be only one person as room owner and we checked already in the if above do we still need this check? would currentUserId.value === item.userId be enough? But I am really confused by the whole topic so... :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the method isRoomOwner is a suitable one to check if a user has this room role which is not the currentUser.
But using it together now with the currentUser somehow confuses the logic within the method for me. What exactly do we want to allow with it? Maybe we can write another method for this usecase (which is still unclear to me) to check for that specific property of the currentUser we want to check for.

}

return !isRoomOwner(item.userId) && belongsToOwnSchool(item.userId);
};

Expand Down
Loading