Client:Store:ContextOptionsStore Fix crash after invite users click
This commit is contained in:
parent
23aaf149de
commit
58c6b9b28e
@ -36,11 +36,8 @@ import { IconButton } from "@docspace/shared/components/icon-button";
|
||||
import { StyledTitle } from "../../../styles/common";
|
||||
import { RoomIcon } from "@docspace/shared/components/room-icon";
|
||||
import RoomsContextBtn from "./context-btn";
|
||||
import {
|
||||
FolderType,
|
||||
RoomsType,
|
||||
ShareAccessRights,
|
||||
} from "@docspace/shared/enums";
|
||||
import { FolderType, RoomsType } from "@docspace/shared/enums";
|
||||
import { getDefaultAccessUser } from "@docspace/shared/utils/getDefaultAccessUser";
|
||||
|
||||
const RoomsItemHeader = ({
|
||||
t,
|
||||
@ -50,13 +47,13 @@ const RoomsItemHeader = ({
|
||||
isGracePeriod,
|
||||
setInvitePanelOptions,
|
||||
setInviteUsersWarningDialogVisible,
|
||||
isPublicRoomType,
|
||||
roomsView,
|
||||
setSelection,
|
||||
setBufferSelection,
|
||||
isArchive,
|
||||
hasLinks,
|
||||
setShowSearchBlock,
|
||||
roomType,
|
||||
}) => {
|
||||
const itemTitleRef = useRef();
|
||||
|
||||
@ -93,9 +90,7 @@ const RoomsItemHeader = ({
|
||||
visible: true,
|
||||
roomId: parentRoomId,
|
||||
hideSelector: false,
|
||||
defaultAccess: isPublicRoomType
|
||||
? ShareAccessRights.RoomManager
|
||||
: ShareAccessRights.ReadOnly,
|
||||
defaultAccess: getDefaultAccessUser(roomType),
|
||||
});
|
||||
};
|
||||
|
||||
@ -171,6 +166,10 @@ export default inject(
|
||||
const selection = infoPanelSelection.length > 1 ? null : infoPanelSelection;
|
||||
const isArchive = selection?.rootFolderType === FolderType.Archive;
|
||||
|
||||
const roomType =
|
||||
selectedFolderStore.roomType ??
|
||||
infoPanelStore.infoPanelSelection?.roomType;
|
||||
|
||||
return {
|
||||
selection,
|
||||
roomsView,
|
||||
@ -184,14 +183,11 @@ export default inject(
|
||||
setInviteUsersWarningDialogVisible:
|
||||
dialogsStore.setInviteUsersWarningDialogVisible,
|
||||
|
||||
isPublicRoomType:
|
||||
(selectedFolderStore.roomType ??
|
||||
infoPanelStore.infoPanelSelection?.roomType) === RoomsType.PublicRoom,
|
||||
|
||||
setSelection: filesStore.setSelection,
|
||||
setBufferSelection: filesStore.setBufferSelection,
|
||||
isArchive,
|
||||
hasLinks: externalLinks.length,
|
||||
roomType,
|
||||
};
|
||||
},
|
||||
)(
|
||||
|
@ -72,9 +72,10 @@ import saveAs from "file-saver";
|
||||
import { isMobile, isIOS } from "react-device-detect";
|
||||
import config from "PACKAGE_FILE";
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
import { ShareAccessRights, RoomsType } from "@docspace/shared/enums";
|
||||
import { RoomsType } from "@docspace/shared/enums";
|
||||
import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||
import { isDesktop } from "@docspace/shared/utils";
|
||||
import { getDefaultAccessUser } from "@docspace/shared/utils/getDefaultAccessUser";
|
||||
import { Events } from "@docspace/shared/enums";
|
||||
import { copyShareLink } from "@docspace/shared/utils/copy";
|
||||
|
||||
@ -794,10 +795,7 @@ class ContextOptionsStore {
|
||||
visible: true,
|
||||
roomId: action ? action : e,
|
||||
hideSelector: false,
|
||||
defaultAccess:
|
||||
roomType === RoomsType.PublicRoom
|
||||
? ShareAccessRights.RoomManager
|
||||
: ShareAccessRights.ReadOnly,
|
||||
defaultAccess: getDefaultAccessUser(roomType),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
42
packages/shared/utils/getDefaultAccessUser.ts
Normal file
42
packages/shared/utils/getDefaultAccessUser.ts
Normal file
@ -0,0 +1,42 @@
|
||||
// (c) Copyright Ascensio System SIA 2009-2024
|
||||
//
|
||||
// This program is a free software product.
|
||||
// You can redistribute it and/or modify it under the terms
|
||||
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||
// any third-party rights.
|
||||
//
|
||||
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
//
|
||||
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||
//
|
||||
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||
//
|
||||
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||
// trademark law for use of our trademarks.
|
||||
//
|
||||
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
import { RoomsType, ShareAccessRights } from "../enums";
|
||||
|
||||
export const getDefaultAccessUser = (
|
||||
roomType: RoomsType,
|
||||
): ShareAccessRights => {
|
||||
switch (roomType) {
|
||||
case RoomsType.FormRoom:
|
||||
return ShareAccessRights.FormFilling;
|
||||
|
||||
case RoomsType.PublicRoom:
|
||||
return ShareAccessRights.RoomManager;
|
||||
|
||||
default:
|
||||
return ShareAccessRights.ReadOnly;
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user