Web: Files: fixed context menu options for private rooms, fixed access rights for sharing
This commit is contained in:
parent
ce15c26c50
commit
d32c68b617
@ -131,10 +131,11 @@ export default function withBadges(WrappedComponent) {
|
||||
item,
|
||||
canWebEdit,
|
||||
isTrashFolder,
|
||||
isPrivacy,
|
||||
isPrivacyFolder,
|
||||
canConvert,
|
||||
onFilesClick, // from withFileAction HOC
|
||||
isAdmin,
|
||||
isDesktopClient,
|
||||
} = this.props;
|
||||
const { fileStatus, access } = item;
|
||||
|
||||
@ -155,7 +156,8 @@ export default function withBadges(WrappedComponent) {
|
||||
canWebEdit={canWebEdit}
|
||||
canConvert={canConvert}
|
||||
isTrashFolder={isTrashFolder}
|
||||
isPrivacy={isPrivacy}
|
||||
isPrivacyFolder={isPrivacyFolder}
|
||||
isDesktopClient={isDesktopClient}
|
||||
accessToEdit={accessToEdit}
|
||||
onClickLock={this.onClickLock}
|
||||
onClickFavorite={this.onClickFavorite}
|
||||
@ -198,7 +200,7 @@ export default function withBadges(WrappedComponent) {
|
||||
setFavoriteAction,
|
||||
markAsRead,
|
||||
} = filesActionsStore;
|
||||
const { isTabletView } = auth.settingsStore;
|
||||
const { isTabletView, isDesktopClient } = auth.settingsStore;
|
||||
const { setIsVerHistoryPanel, fetchFileVersions } = versionHistoryStore;
|
||||
const {
|
||||
setNewFilesPanelVisible,
|
||||
@ -220,7 +222,7 @@ export default function withBadges(WrappedComponent) {
|
||||
canWebEdit,
|
||||
canConvert,
|
||||
isTrashFolder: isRecycleBinFolder,
|
||||
isPrivacy: isPrivacyFolder,
|
||||
isPrivacyFolder,
|
||||
lockFileAction,
|
||||
setFavoriteAction,
|
||||
homepage: config.homepage,
|
||||
@ -239,6 +241,7 @@ export default function withBadges(WrappedComponent) {
|
||||
fetchFiles,
|
||||
setConvertDialogVisible,
|
||||
setConvertItem,
|
||||
isDesktopClient,
|
||||
};
|
||||
}
|
||||
)(observer(WithBadges));
|
||||
|
@ -141,6 +141,7 @@ export default function withFileActions(WrappedFileItem) {
|
||||
canWebEdit,
|
||||
item,
|
||||
isTrashFolder,
|
||||
isPrivacy,
|
||||
openDocEditor,
|
||||
expandedKeys,
|
||||
addExpandedKeys,
|
||||
@ -156,8 +157,20 @@ export default function withFileActions(WrappedFileItem) {
|
||||
providerKey,
|
||||
contentLength,
|
||||
fileStatus,
|
||||
encrypted,
|
||||
} = item;
|
||||
|
||||
if (encrypted && isPrivacy) {
|
||||
console.log("item", item);
|
||||
return;
|
||||
|
||||
// if (localStorage.getItem("protocoldetector") == 1) {
|
||||
// openCustomProtocolInIframe(customUrlForFileOpenDesktopEditor);
|
||||
// } else {
|
||||
// window.open(urlForOpenPrivate, "_blank");
|
||||
// }
|
||||
}
|
||||
|
||||
if (isTrashFolder) return;
|
||||
|
||||
if (!fileExst && !contentLength) {
|
||||
|
@ -13,7 +13,8 @@ const Badges = ({
|
||||
item,
|
||||
canWebEdit,
|
||||
isTrashFolder,
|
||||
isPrivacy,
|
||||
isPrivacyFolder,
|
||||
isDesktopClient,
|
||||
canConvert,
|
||||
accessToEdit,
|
||||
showNew,
|
||||
@ -30,6 +31,7 @@ const Badges = ({
|
||||
const isEditing = fileStatus === 1;
|
||||
const isNewWithFav = fileStatus === 34;
|
||||
const showEditBadge = !locked || item.access === 0;
|
||||
const isPrivacy = isPrivacyFolder && isDesktopClient;
|
||||
|
||||
return fileExst ? (
|
||||
<div className="badges additional-badges">
|
||||
@ -46,7 +48,7 @@ const Badges = ({
|
||||
)}
|
||||
{canWebEdit &&
|
||||
!isTrashFolder &&
|
||||
!isPrivacy &&
|
||||
isPrivacy &&
|
||||
accessToEdit &&
|
||||
showEditBadge &&
|
||||
!canConvert && (
|
||||
|
@ -19,9 +19,13 @@ class AddUsersPanelComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
const accessRight = props.isEncrypted
|
||||
? ShareAccessRights.FullAccess
|
||||
: ShareAccessRights.ReadOnly;
|
||||
|
||||
this.state = {
|
||||
showActionPanel: false,
|
||||
accessRight: ShareAccessRights.ReadOnly,
|
||||
accessRight,
|
||||
};
|
||||
|
||||
this.scrollRef = React.createRef();
|
||||
@ -89,25 +93,6 @@ class AddUsersPanelComponent extends React.Component {
|
||||
window.removeEventListener("keyup", this.onKeyPress);
|
||||
}
|
||||
|
||||
// shouldComponentUpdate(nextProps, nextState) {
|
||||
// const { showActionPanel, accessRight } = this.state;
|
||||
// const { visible } = this.props;
|
||||
|
||||
// if (accessRight !== nextState.accessRight) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// if (showActionPanel !== nextState.showActionPanel) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// if (visible !== nextProps.visible) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// return false;
|
||||
// }
|
||||
|
||||
onAccessChange = (e) => {
|
||||
const accessRight = +e.currentTarget.dataset.access;
|
||||
this.setState({ accessRight });
|
||||
|
@ -21,10 +21,10 @@ newInstance.use(Backend).init({
|
||||
},
|
||||
|
||||
backend: {
|
||||
loadPath: loadLanguagePath(config.homepage, "SharingPanel"),
|
||||
loadPath: loadLanguagePath(config.homepage),
|
||||
},
|
||||
|
||||
ns: ["SharingPanel", "Common"],
|
||||
ns: ["SharingPanel", "Common", "Translations"],
|
||||
defaultNS: "SharingPanel",
|
||||
|
||||
react: {
|
||||
|
@ -397,6 +397,7 @@ class SharingPanelComponent extends React.Component {
|
||||
uploadPanelVisible,
|
||||
documentTitle,
|
||||
sharingPanelVisible,
|
||||
isPrivacy,
|
||||
} = this.props;
|
||||
const {
|
||||
showActionPanel,
|
||||
@ -416,7 +417,12 @@ class SharingPanelComponent extends React.Component {
|
||||
const visible = sharingPanelVisible;
|
||||
const zIndex = 310;
|
||||
const onPlusClickProp = !isLoading ? { onClick: this.onPlusClick } : {};
|
||||
const internalLink = selection.length === 1 && this.getInternalLink();
|
||||
|
||||
const isEncrypted =
|
||||
isPrivacy || (selection.length && selection[0].encrypted);
|
||||
|
||||
const internalLink =
|
||||
selection.length === 1 && !isEncrypted && this.getInternalLink();
|
||||
|
||||
return (
|
||||
<StyledAsidePanel visible={visible}>
|
||||
@ -462,10 +468,12 @@ class SharingPanelComponent extends React.Component {
|
||||
label={t("LinkText")}
|
||||
onClick={this.onShowUsersPanel}
|
||||
/>
|
||||
<DropDownItem
|
||||
label={t("AddGroupsForSharingButton")}
|
||||
onClick={this.onShowGroupsPanel}
|
||||
/>
|
||||
{!isEncrypted && (
|
||||
<DropDownItem
|
||||
label={t("AddGroupsForSharingButton")}
|
||||
onClick={this.onShowGroupsPanel}
|
||||
/>
|
||||
)}
|
||||
</DropDown>
|
||||
</div>
|
||||
|
||||
@ -552,6 +560,7 @@ class SharingPanelComponent extends React.Component {
|
||||
groupsCaption={groupsCaption}
|
||||
accessOptions={accessOptions}
|
||||
isMultiSelect
|
||||
isEncrypted={isEncrypted}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
@ -379,6 +379,7 @@ class FilesStore {
|
||||
const isEncrypted = item.encrypted;
|
||||
const isDocuSign = false; //TODO: need this prop;
|
||||
const isEditing = false; //TODO: need this prop;
|
||||
const isFileOwner = item.createdBy.id === this.userStore.user.id;
|
||||
|
||||
const {
|
||||
isRecycleBinFolder,
|
||||
@ -627,7 +628,7 @@ class FilesStore {
|
||||
"delete",
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
} else if (!isEncrypted) {
|
||||
fileOptions = this.removeOptions(fileOptions, ["unsubscribe"]);
|
||||
}
|
||||
|
||||
@ -637,9 +638,17 @@ class FilesStore {
|
||||
"view",
|
||||
"separator0",
|
||||
"copy",
|
||||
"unsubscribe",
|
||||
"download-as",
|
||||
]);
|
||||
|
||||
if (!this.authStore.settingsStore.isDesktopClient) {
|
||||
fileOptions = this.removeOptions(fileOptions, ["sharing-settings"]);
|
||||
}
|
||||
|
||||
fileOptions = this.removeOptions(
|
||||
fileOptions,
|
||||
isFileOwner ? ["unsubscribe"] : ["move-to", "delete"]
|
||||
);
|
||||
}
|
||||
|
||||
return fileOptions;
|
||||
@ -994,6 +1003,7 @@ class FilesStore {
|
||||
contentLength,
|
||||
created,
|
||||
createdBy,
|
||||
encrypted,
|
||||
fileExst,
|
||||
filesCount,
|
||||
fileStatus,
|
||||
@ -1033,6 +1043,7 @@ class FilesStore {
|
||||
contextOptions,
|
||||
created,
|
||||
createdBy,
|
||||
encrypted,
|
||||
fileExst,
|
||||
filesCount,
|
||||
fileStatus,
|
||||
@ -1165,6 +1176,10 @@ class FilesStore {
|
||||
canWebFilterEditing,
|
||||
} = this.formatsStore.docserviceStore;
|
||||
|
||||
if (selection[0].encrypted) {
|
||||
return ["FullAccess", "DenyAccess"];
|
||||
}
|
||||
|
||||
let AccessOptions = [];
|
||||
|
||||
AccessOptions.push("ReadOnly", "DenyAccess");
|
||||
|
Loading…
Reference in New Issue
Block a user