Merge pull request #208 from ONLYOFFICE/bugfix/privacy-room

Bugfix/privacy room
This commit is contained in:
Alexey Safronov 2021-03-31 19:08:31 +03:00 committed by GitHub
commit e9c62be0ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 70 additions and 53 deletions

View File

@ -18,7 +18,10 @@ class SettingsStore {
timezones = [];
utcOffset = "00:00:00";
utcHoursOffset = 0;
defaultPage = combineUrl(proxyURL, "/");
defaultPage = combineUrl(
proxyURL,
window["AscDesktopEditor"] !== undefined ? "/products/files/" : "/"
);
homepage = "";
datePattern = "M/d/yyyy";
datePatternJQ = "00/00/0000";

View File

@ -81,7 +81,7 @@
"PrivateRoomDescriptionSecure": "Secure sharing with trusted teammates.",
"PrivateRoomDescriptionEncrypted": "Encrypted editing and real-time collaboration.",
"PrivateRoomDescriptionUnbreakable": "Unbreakable AES-256 algorithm.",
"PrivateRoomSupport": "Work in Private Room is available via {{organizationName}} desktop app. <3>Instructions</3>",
"PrivateRoomSupport": "Work in Private Room is available via {{organizationName}} desktop app. <4>Instructions</4>",
"GoToMyButton": "Go to My Documents",
"BackToParentFolderButton": "Back to parent folder",
"EmptyFolderHeader": "No files in this folder",

View File

@ -81,7 +81,7 @@
"PrivateRoomDescriptionSecure": "Безопасное предоставление доступа доверенным участникам команды.",
"PrivateRoomDescriptionEncrypted": "Зашифрованное редактирование и совместная работа в режиме реального времени.",
"PrivateRoomDescriptionUnbreakable": "Стойкий алгоритм AES-256.",
"PrivateRoomSupport": "Работа в Приватной комнате доступна через десктопное приложение {{organizationName}}. <3>Инструкции</3>",
"PrivateRoomSupport": "Работа в Приватной комнате доступна через десктопное приложение {{organizationName}}. <4>Инструкции</4>",
"GoToMyButton": "Перейти к моим документам",
"BackToParentFolderButton": "Вернуться в папку на уровень выше",
"EmptyFolderHeader": "В этой папке нет файлов",

View File

@ -21,7 +21,7 @@ import filesActionsStore from "./store/FilesActionsStore";
import "./custom.scss";
import i18n from "./i18n";
import { I18nextProvider } from "react-i18next";
//import { regDesktop } from "@appserver/common/src/desktop";
import { regDesktop } from "@appserver/common/desktop";
import Home from "./components/pages/Home";
import Settings from "./components/pages/Settings";
import VersionHistory from "./components/pages/VersionHistory";
@ -79,33 +79,33 @@ class FilesContent extends React.Component {
});
}
// componentDidUpdate(prevProps) {
// const {
// isAuthenticated,
// user,
// isEncryption,
// encryptionKeys,
// setEncryptionKeys,
// isLoaded,
// } = this.props;
// //console.log("componentDidUpdate: ", this.props);
// if (isAuthenticated && !this.isDesktopInit && isEncryption && isLoaded) {
// this.isDesktopInit = true;
// regDesktop(
// user,
// isEncryption,
// encryptionKeys,
// setEncryptionKeys,
// this.isEditor
// );
// console.log(
// "%c%s",
// "color: green; font: 1.2em bold;",
// "Current keys is: ",
// encryptionKeys
// );
// }
// }
componentDidUpdate(prevProps) {
const {
isAuthenticated,
user,
isEncryption,
encryptionKeys,
setEncryptionKeys,
isLoaded,
} = this.props;
//console.log("componentDidUpdate: ", this.props);
if (isAuthenticated && !this.isDesktopInit && isEncryption && isLoaded) {
this.isDesktopInit = true;
regDesktop(
user,
isEncryption,
encryptionKeys,
setEncryptionKeys,
this.isEditor
);
console.log(
"%c%s",
"color: green; font: 1.2em bold;",
"Current keys is: ",
encryptionKeys
);
}
}
render() {
//const { /*, isDesktop*/ } = this.props;
@ -127,7 +127,7 @@ class FilesContent extends React.Component {
const Files = inject(({ auth, initFilesStore }) => {
return {
//isDesktop: auth.settingsStore.isDesktopClient,
isDesktop: auth.settingsStore.isDesktopClient,
user: auth.userStore.user,
isAuthenticated: auth.isAuthenticated,
encryptionKeys: auth.settingsStore.encryptionKeys,

View File

@ -111,8 +111,8 @@ const RootFolderContainer = (props) => {
{!isDesktop && (
<Text fontSize="12px">
<Trans i18nKey="PrivateRoomSupport" ns="Home">
Work in Private Room is available via {{ organizationName }}
desktop app.
Work in Private Room is available via {{ organizationName }} desktop
app.{" "}
<Link isBold isHovered color="#116d9d" href={privacyInstructions}>
Instructions
</Link>

View File

@ -19,6 +19,7 @@ const EmptyContainer = ({
setAction,
isPrivacyFolder,
parentId,
isEncryptionSupport,
}) => {
const onCreate = (e) => {
const format = e.currentTarget.dataset.format || null;

View File

@ -317,7 +317,7 @@ class SectionHeaderContent extends React.Component {
getMenuItems = () => {
const {
t,
isItemsSelected,
selectionCount,
isAccessedSelected,
isWebEditSelected,
deleteDialogVisible,
@ -383,33 +383,33 @@ class SectionHeaderContent extends React.Component {
label: t("Share"),
disabled:
!isAccessedSelected ||
(isPrivacy && (isOnlyFoldersSelected || isItemsSelected)),
(isPrivacy && (isOnlyFoldersSelected || selectionCount > 1)),
onClick: this.onOpenSharingPanel,
},
{
label: t("Download"),
disabled: !isItemsSelected,
disabled: !selectionCount,
onClick: this.downloadAction,
},
{
label: t("DownloadAs"),
disabled: !isItemsSelected || !isWebEditSelected,
disabled: !selectionCount || !isWebEditSelected,
onClick: this.downloadAsAction,
},
{
label: t("MoveTo"),
disabled: !isItemsSelected || isThirdPartySelection,
disabled: !selectionCount || isThirdPartySelection,
onClick: this.onMoveAction,
},
{
label: t("Copy"),
disabled: !isItemsSelected,
disabled: !selectionCount,
onClick: this.onCopyAction,
},
{
label: t("Delete"),
disabled:
!isItemsSelected || !deleteDialogVisible || isThirdPartySelection,
!selectionCount || !deleteDialogVisible || isThirdPartySelection,
onClick: this.onDeleteAction,
},
];
@ -605,7 +605,7 @@ export default inject(
isPrivacy: isPrivacyFolder,
filter,
canCreate,
isItemsSelected: !!selection.length,
selectionCount: selection.length,
isHeaderVisible,
isHeaderIndeterminate,
isHeaderChecked,

View File

@ -20,7 +20,7 @@ import { combineUrl } from "@appserver/common/utils";
const { FilesFilter } = api;
const { settingsStore, userStore, isAdmin } = store.auth;
const { isEncryptionSupport, isDesktopClient } = settingsStore;
const {
iconFormatsStore,
mediaViewersFormatsStore,
@ -217,7 +217,7 @@ class FilesStore {
setSelectedNode([folderId + ""]);
if (privacyFolder && privacyFolder.id === +folderId) {
if (!isEncryptionSupport) {
if (!store.auth.settingsStore.isEncryptionSupport) {
const newExpandedKeys = createTreeFolders(
privacyFolder.pathParts,
expandedKeys
@ -251,9 +251,15 @@ class FilesStore {
filterData.total = data.total;
this.setFilesFilter(filterData); //TODO: FILTER
this.setFolders(
isPrivacyFolder && !isEncryptionSupport ? [] : data.folders
isPrivacyFolder && !store.auth.settingsStore.isEncryptionSupport
? []
: data.folders
);
this.setFiles(
isPrivacyFolder && !store.auth.settingsStore.isEncryptionSupport
? []
: data.files
);
this.setFiles(isPrivacyFolder && !isEncryptionSupport ? [] : data.files);
if (clearFilter) {
this.fileActionStore.setAction({ type: null });
this.setSelected("close");
@ -547,7 +553,10 @@ class FilesStore {
const canCreateInSharedFolder = selectedFolderStore.access === 1;
return !selectedFolderStore.isRootFolder && canCreateInSharedFolder;
case FolderType.Privacy:
return isDesktopClient && isEncryptionSupport;
return (
store.auth.settingsStore.isDesktopClient &&
store.auth.settingsStore.isEncryptionSupport
);
case FolderType.COMMON:
return isAdmin;
case FolderType.TRASH:
@ -714,14 +723,14 @@ class FilesStore {
get isAccessedSelected() {
return (
this.selection.length &&
isAdmin &&
this.selection.every((x) => x.access === 1 || x.access === 0)
(this.selection.length &&
this.selection.every((x) => x.access === 1 || x.access === 0)) ||
(isAdmin && this.selection.length)
);
}
get isOnlyFoldersSelected() {
return this.selection.every((selected) => selected.fileExst !== undefined);
return this.selection.every((selected) => selected.fileExst === undefined);
}
get isThirdPartySelection() {

View File

@ -54,7 +54,7 @@ const StyledContainer = styled.header`
#ipl-progress-indicator {
position: fixed;
z-index: 190;
top: 56px;
top: ${(props) => (props.isDesktop ? "0" : "56px")};
left: -6px;
width: 0%;
height: 3px;
@ -159,7 +159,11 @@ class NavMenu extends React.Component {
return (
<LayoutContextConsumer>
{(value) => (
<StyledContainer isLoaded={isLoaded} isVisible={value.isVisible}>
<StyledContainer
isLoaded={isLoaded}
isVisible={value.isVisible}
isDesktop={isDesktop}
>
<Toast />
<Backdrop