Web: Changed canChangeUserRole function.
This commit is contained in:
parent
7150aa67ec
commit
42d7a6dda7
@ -16,6 +16,8 @@ const User = ({
|
||||
selectionParentRoom,
|
||||
setSelectionParentRoom,
|
||||
canChangeUserRole,
|
||||
rootFolderType,
|
||||
access,
|
||||
}) => {
|
||||
if (!selectionParentRoom) return null;
|
||||
if (!user.displayName && !user.email) return null;
|
||||
@ -66,7 +68,13 @@ const User = ({
|
||||
}
|
||||
};
|
||||
|
||||
const isCanChangeUserRole = user && canChangeUserRole(user);
|
||||
const isCanChangeUserRole =
|
||||
user &&
|
||||
canChangeUserRole({
|
||||
access,
|
||||
rootFolderType,
|
||||
currentUserInList: { id: user.id, access: user.access },
|
||||
});
|
||||
|
||||
return (
|
||||
<StyledUser isExpect={isExpect} key={user.id}>
|
||||
|
@ -38,10 +38,11 @@ const Members = ({
|
||||
|
||||
const [members, setMembers] = useState(null);
|
||||
const [showLoader, setShowLoader] = useState(false);
|
||||
const { access, rootFolderType } = selection;
|
||||
|
||||
const canInviteUserInRoomAbility = canInviteUserInRoom({
|
||||
access: selection.access,
|
||||
rootFolderType: selection.rootFolderType,
|
||||
access,
|
||||
rootFolderType,
|
||||
});
|
||||
|
||||
const fetchMembers = async (roomId) => {
|
||||
@ -142,6 +143,8 @@ const Members = ({
|
||||
<StyledUserList>
|
||||
{Object.values(members.inRoom).map((user) => (
|
||||
<User
|
||||
access={access}
|
||||
rootFolderType={rootFolderType}
|
||||
key={user.id}
|
||||
t={t}
|
||||
user={user}
|
||||
@ -176,6 +179,8 @@ const Members = ({
|
||||
<StyledUserList>
|
||||
{Object.values(members.expected).map((user) => (
|
||||
<User
|
||||
access={access}
|
||||
rootFolderType={rootFolderType}
|
||||
isExpect
|
||||
key={user.id}
|
||||
t={t}
|
||||
|
@ -31,17 +31,17 @@ class AccessRightsStore {
|
||||
return getRoomRoleActions(access).inviteUsers;
|
||||
}
|
||||
|
||||
canChangeUserRole = (currentRoomMember) => {
|
||||
// const { isArchiveFolderRoot } = this.treeFoldersStore;
|
||||
const { access } = this.selectedFolderStore;
|
||||
canChangeUserRole = (room) => {
|
||||
const { access, rootFolderType, currentUserInList } = room;
|
||||
const { userStore } = this.authStore;
|
||||
const { user } = userStore;
|
||||
|
||||
const isMyProfile = user.id === currentRoomMember.id;
|
||||
const isMyProfile = user.id === currentUserInList.id;
|
||||
const isOwnerRoleRoom =
|
||||
currentRoomMember.access === ShareAccessRights.FullAccess;
|
||||
currentUserInList.access === ShareAccessRights.FullAccess;
|
||||
|
||||
// if (isArchiveFolderRoot || isMyProfile || isOwnerRoleRoom) return false;
|
||||
if (rootFolderType === FolderType.Archive || isMyProfile || isOwnerRoleRoom)
|
||||
return false;
|
||||
|
||||
return getRoomRoleActions(access).changeUserRole;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user