Merge branch 'develop' into feature/translations

This commit is contained in:
Alexey Safronov 2021-04-28 13:08:52 +03:00
commit 8fc80a419b
26 changed files with 143 additions and 76 deletions

View File

@ -1,5 +1,5 @@
{
"version": "0.1.7",
"version": "0.1.8",
"npmClient": "yarn",
"packages": [
"packages/asc-web-components",

View File

@ -12,7 +12,7 @@ export function openEdit(fileId, version, doc) {
}
if (doc) {
params.push(`version=${version}`);
params.push(`doc=${doc}`);
}
const paramsString = params.length > 0 ? `?${params.join("&")}` : "";

View File

@ -1,6 +1,6 @@
{
"name": "@appserver/common",
"version": "0.0.2",
"version": "0.0.3",
"private": true,
"scripts": {
"build": "echo 'skip it'",

View File

@ -8,7 +8,7 @@ import UserStore from "./UserStore";
import { logout as logoutDesktop, desktopConstants } from "../desktop";
import { combineUrl, isAdmin } from "../utils";
import isEmpty from "lodash/isEmpty";
import { AppServerConfig } from "../constants";
import { AppServerConfig, LANGUAGE } from "../constants";
const { proxyURL } = AppServerConfig;
class AuthStore {
@ -43,7 +43,14 @@ class AuthStore {
return Promise.all(requests);
};
setLanguage() {
if (this.userStore.user.cultureName) {
localStorage.getItem(LANGUAGE) !== this.userStore.user.cultureName &&
localStorage.setItem(LANGUAGE, this.userStore.user.cultureName);
} else {
localStorage.setItem(LANGUAGE, this.settingsStore.culture || "en-US");
}
}
get isLoaded() {
let success = false;
if (this.isAuthenticated) {
@ -51,6 +58,8 @@ class AuthStore {
this.userStore.isLoaded &&
this.moduleStore.isLoaded &&
this.settingsStore.isLoaded;
success && this.setLanguage();
} else {
success = this.settingsStore.isLoaded;
}

View File

@ -1,6 +1,5 @@
import { action, makeObservable, observable } from "mobx";
import api from "../api";
import { LANGUAGE } from "../constants";
class UserStore {
user = null;
@ -21,9 +20,7 @@ class UserStore {
getCurrentUser = async () => {
const user = await api.people.getUser();
user.cultureName &&
localStorage.getItem(LANGUAGE) !== user.cultureName &&
localStorage.setItem(LANGUAGE, user.cultureName);
this.setUser(user);
};

View File

@ -15,6 +15,7 @@ const StyledLabel = styled.label`
.checkbox {
margin-right: 12px;
overflow: visible;
}
/* ${(props) =>

View File

@ -1,6 +1,6 @@
{
"name": "@appserver/components",
"version": "0.0.2",
"version": "0.0.3",
"private": true,
"scripts": {
"build": "echo 'skip it'",

View File

@ -1,6 +1,6 @@
{
"name": "@appserver/crm",
"version": "0.1.7",
"version": "0.1.8",
"private": "true",
"homepage": "/products/crm",
"title": "ONLYOFFICE",

View File

@ -1,6 +1,6 @@
{
"name": "@appserver/files",
"version": "0.1.7",
"version": "0.1.8",
"private": "true",
"homepage": "/products/files",
"id": "e67be73d-f9ae-4ce1-8fec-1880cb518cb4",

View File

@ -81,6 +81,7 @@ const PureTreeSettings = ({
history,
setIsLoading,
t,
isVisitor,
}) => {
const { setting } = match.params;
@ -168,7 +169,7 @@ const PureTreeSettings = ({
title={t("TreeSettingsAdminSettings")}
/>
) : null}
{enableThirdParty ? (
{enableThirdParty && !isVisitor ? (
<TreeNode
selectable={true}
className="settings-node"
@ -226,6 +227,7 @@ export default inject(
return {
isAdmin: auth.isAdmin,
isVisitor: auth.userStore.user.isVisitor,
isLoading,
selectedTreeNode,
enableThirdParty,

View File

@ -85,6 +85,7 @@ class ArticleBodyContent extends React.Component {
onTreeDrop,
selectedTreeNode,
enableThirdParty,
isVisitor,
} = this.props;
return isEmpty(treeFolders) ? (
@ -99,7 +100,7 @@ class ArticleBodyContent extends React.Component {
onTreeDrop={onTreeDrop}
/>
<TreeSettings />
{enableThirdParty && <ThirdPartyList />}
{enableThirdParty && !isVisitor && <ThirdPartyList />}
</>
);
}
@ -107,6 +108,7 @@ class ArticleBodyContent extends React.Component {
export default inject(
({
auth,
filesStore,
treeFoldersStore,
selectedFolderStore,
@ -129,6 +131,7 @@ export default inject(
selectedTreeNode,
filter,
enableThirdParty: settingsStore.enableThirdParty,
isVisitor: auth.userStore.user.isVisitor,
setIsLoading,
fetchFiles,

View File

@ -48,7 +48,7 @@ const Badges = ({
hoverColor="#3B72A7"
/>
)}
{locked && (
{locked && accessToEdit && (
<StyledFileActionsLockedIcon
className="badge lock-file icons-group"
size="small"

View File

@ -77,14 +77,10 @@ class SharingPanelComponent extends React.Component {
};
updateRowData = (newRowData) => {
const { setFile, setFolder } = this.props;
const { getFileInfo, getFolderInfo } = this.props;
for (let item of newRowData) {
if (!item.fileExst) {
setFolder(item);
} else {
setFile(item);
}
!item.fileExst ? getFolderInfo(item.id) : getFileInfo(item.id);
}
};
@ -172,8 +168,8 @@ class SharingPanelComponent extends React.Component {
ownerId
)
.then((res) => {
if (ownerId) {
this.updateRowData(res[0]);
if (!ownerId) {
this.updateRowData(selection);
}
if (isPrivacy && isDesktop) {
if (share.length === 0) return Promise.resolve();
@ -610,6 +606,8 @@ const SharingPanel = inject(
getShareUsers,
setShareFiles,
setIsLoading,
getFileInfo,
getFolderInfo,
isLoading,
} = filesStore;
const { isPrivacyFolder } = treeFoldersStore;
@ -644,6 +642,8 @@ const SharingPanel = inject(
setFolder,
getShareUsers,
setShareFiles,
getFileInfo,
getFolderInfo,
};
}
)(observer(withTranslation("SharingPanel")(SharingPanelComponent)));

View File

@ -323,6 +323,7 @@ class SectionHeaderContent extends React.Component {
isOnlyFoldersSelected,
isFavoritesFolder,
isRecentFolder,
isShareFolder,
} = this.props;
let menu = [
@ -401,6 +402,7 @@ class SectionHeaderContent extends React.Component {
disabled:
isFavoritesFolder ||
isRecentFolder ||
isShareFolder ||
!isAccessedSelected ||
!selectionCount ||
isThirdPartySelection,
@ -591,6 +593,7 @@ export default inject(
isPrivacyFolder,
isFavoritesFolder,
isRecentFolder,
isShareFolder,
} = treeFoldersStore;
const { setAction } = fileActionStore;
const {
@ -614,6 +617,7 @@ export default inject(
isPrivacy: isPrivacyFolder,
isFavoritesFolder,
isRecentFolder,
isShareFolder,
filter,
canCreate,
selectionCount: selection.length,

View File

@ -71,17 +71,18 @@ class FilesActionStore {
}
if (folderIds.length || fileIds.length) {
setSecondaryProgressBarData({
icon: "trash",
visible: true,
label: translations.deleteOperation,
percent: 0,
alert: false,
});
return removeFiles(folderIds, fileIds, deleteAfter, immediately)
.then((res) => {
const id = res[0] && res[0].id ? res[0].id : null;
const currentProcess = res.find((x) => x.id === id);
setSecondaryProgressBarData({
icon: "trash",
visible: true,
label: translations.deleteOperation,
percent: currentProcess.progress,
alert: false,
});
this.loopDeleteOperation(id, translations);
})
.catch((err) => {

View File

@ -574,7 +574,7 @@ class FilesStore {
]);
}
if (isCommonFolder)
if (isCommonFolder) {
if (!this.userAccess) {
fileOptions = this.removeOptions(fileOptions, [
"owner-change",
@ -586,6 +586,7 @@ class FilesStore {
fileOptions = this.removeOptions(fileOptions, ["separator2"]);
}
}
}
if (withoutShare) {
fileOptions = this.removeOptions(fileOptions, [
@ -604,6 +605,10 @@ class FilesStore {
fileOptions = this.removeOptions(fileOptions, ["separator2"]);
}
if (isShareFolder) {
fileOptions = this.removeOptions(fileOptions, ["move-to"]);
}
return fileOptions;
} else {
let folderOptions = [
@ -630,6 +635,10 @@ class FilesStore {
folderOptions = this.removeOptions(folderOptions, ["copy"]);
}
if (isShareFolder) {
folderOptions = this.removeOptions(folderOptions, ["move-to"]);
}
if (isRecycleBinFolder) {
folderOptions = this.removeOptions(folderOptions, [
"open",
@ -1222,6 +1231,11 @@ class FilesStore {
this.setFile(fileInfo);
};
getFolderInfo = async (id) => {
const folderInfo = await api.files.getFolderInfo(id);
this.setFolder(folderInfo);
};
openDocEditor = (id, providerKey = null, tab = null, url = null) => {
if (providerKey) {
tab

View File

@ -1,6 +1,6 @@
{
"name": "@appserver/people",
"version": "0.1.7",
"version": "0.1.8",
"private": "true",
"homepage": "/products/people",
"id": "f4d98afd-d336-4332-8778-3c6945c81ea0",

View File

@ -40,7 +40,7 @@ class GroupAction extends React.Component {
render() {
console.log("GroupAction render");
const { group, match } = this.props;
const { group, match, tReady } = this.props;
return (
<>
@ -63,7 +63,7 @@ class GroupAction extends React.Component {
</PageLayout.SectionHeader>
<PageLayout.SectionBody>
<SectionBodyContent />
<SectionBodyContent tReady={tReady} />
</PageLayout.SectionBody>
</PageLayout>
) : (

View File

@ -1,6 +1,6 @@
{
"name": "@appserver/projects",
"version": "0.1.7",
"version": "0.1.8",
"private": "true",
"homepage": "/products/projects",
"id": "1e044602-43b5-4d79-82f3-fd6208a11960",

View File

@ -1,6 +1,6 @@
{
"name": "@appserver/studio",
"version": "0.1.7",
"version": "0.1.8",
"private": "true",
"homepage": "",
"title": "ONLYOFFICE",

View File

@ -1,5 +1,5 @@
import React from "react";
import { Link } from 'react-router-dom';
import { Link } from "react-router-dom";
import PropTypes from "prop-types";
import styled from "styled-components";
import { inject, observer } from "mobx-react";
@ -25,7 +25,7 @@ const NavLogoItem = (props) => {
//console.log("NavLogoItem render");
return (
<LogoItem opened={props.opened}>
<Link className="nav-logo-wrapper" to="/">
<Link className="nav-logo-wrapper" to="/" onClick={props.onClick}>
<img className="nav-logo-icon" src={props.logoUrl} />
</Link>
</LogoItem>

View File

@ -1,5 +1,5 @@
import React, { lazy } from "react";
import { Route, Switch } from "react-router-dom";
import { Switch } from "react-router-dom";
import ConfirmRoute from "../../../helpers/confirmRoute";
const ActivateUserForm = lazy(() => import("./sub-components/activateUser"));
@ -37,7 +37,7 @@ const Confirm = ({ match }) => {
path={`${match.path}/EmailChange`}
component={ChangeEmailForm}
/>
<Route
<ConfirmRoute
forUnauthorized
path={`${match.path}/PasswordChange`}
component={ChangePasswordForm}
@ -47,7 +47,7 @@ const Confirm = ({ match }) => {
path={`${match.path}/ProfileRemove`}
component={ProfileRemoveForm}
/>
<Route
<ConfirmRoute
exact
path={`${match.path}/PhoneActivation`}
component={ChangePhoneForm}
@ -57,7 +57,6 @@ const Confirm = ({ match }) => {
path={`${match.path}/PortalOwnerChange`}
component={ChangeOwnerForm}
/>
{/* <Route component={Error404} /> */}
</Switch>
);
};

View File

@ -12,6 +12,7 @@ import SaveCancelButtons from "@appserver/components/save-cancel-buttons";
import { saveToSessionStorage, getFromSessionStorage } from "../../utils";
import { setDocumentTitle } from "../../../../../helpers/utils";
import { inject, observer } from "mobx-react";
import { LANGUAGE } from "@appserver/common/constants";
const mapCulturesToArray = (cultures, t) => {
return cultures.map((culture) => {
@ -176,7 +177,13 @@ class LanguageAndTimeZone extends React.Component {
timezoneDefault,
languageDefault,
} = this.state;
const { i18n, language, nameSchemaId, getCurrentCustomSchema } = this.props;
const {
i18n,
language,
nameSchemaId,
getCurrentCustomSchema,
t,
} = this.props;
if (timezones.length && languages.length && !prevState.isLoadedData) {
this.setState({ isLoadedData: true });
@ -229,12 +236,20 @@ class LanguageAndTimeZone extends React.Component {
};
onSaveLngTZSettings = () => {
const { t, setLanguageAndTime, i18n } = this.props;
const { t, setLanguageAndTime, user, language: lng } = this.props;
const { language, timezone } = this.state;
this.setState({ isLoading: true }, function () {
setLanguageAndTime(language.key, timezone.key)
.then(() => i18n.changeLanguage(language.key))
.then(
() =>
!user.cultureName &&
localStorage.setItem(LANGUAGE, language.key || "en-US")
)
.then(() => toastr.success(t("SuccessfullySaveSettingsMessage")))
.then(
() => !user.cultureName && lng !== language.key && location.reload()
)
.catch((error) => toastr.error(error))
.finally(() => this.setState({ isLoading: false }));
});
@ -403,9 +418,12 @@ export default inject(({ auth, setup }) => {
getCurrentCustomSchema,
} = auth.settingsStore;
const { user } = auth.userStore;
const { setLanguageAndTime } = setup;
return {
user,
portalLanguage: culture,
portalTimeZoneId: timezone,
language: culture,

View File

@ -1,6 +1,6 @@
{
"name": "@appserver/editor",
"version": "0.1.7",
"version": "0.1.8",
"private": "true",
"homepage": "/products/files/doceditor",
"title": "ONLYOFFICE",

View File

@ -93,17 +93,21 @@ const Editor = () => {
//showLoader();
const docApiUrl = await getDocServiceUrl();
const success = await checkIsAuthenticated();
if (!doc) {
const success = await checkIsAuthenticated();
if (!success) {
return tryRedirectTo(combineUrl(AppServerConfig.proxyURL, "/login"));
} else {
setIsAuthenticated(success);
}
if (!doc && !success) {
return tryRedirectTo(combineUrl(AppServerConfig.proxyURL, "/login"));
}
if (success) {
try {
fileInfo = await getFileInfo(fileId);
} catch (err) {
console.error(err);
}
setIsAuthenticated(success);
}
fileInfo = await getFileInfo(fileId);
config = await openEdit(fileId, version, doc);
@ -145,7 +149,8 @@ const Editor = () => {
if (
config &&
config.document.permissions.edit &&
config.document.permissions.modifyFilter
config.document.permissions.modifyFilter &&
fileInfo
) {
const sharingSettings = await SharingDialog.getSharingSettings(fileId);
config.document.info = {
@ -249,20 +254,36 @@ const Editor = () => {
config.type = "mobile";
}
const filterObj = FilesFilter.getDefault();
filterObj.folder = fileInfo.folderId;
const urlFilter = filterObj.toUrlParams();
let goback;
config.editorConfig.customization = {
...config.editorConfig.customization,
goback: {
if (fileInfo) {
const filterObj = FilesFilter.getDefault();
filterObj.folder = fileInfo.folderId;
const urlFilter = filterObj.toUrlParams();
goback = {
blank: true,
requestClose: false,
text: i18n.t("FileLocation"),
url: `${combineUrl(filesUrl, `/filter?${urlFilter}`)}`,
},
};
}
config.editorConfig.customization = {
...config.editorConfig.customization,
goback,
};
let onRequestSharingSettings;
if (
fileInfo &&
config.document.permissions.edit &&
config.document.permissions.modifyFilter
) {
onRequestSharingSettings = onSDKRequestSharingSettings;
}
const events = {
events: {
onAppReady: onSDKAppReady,
@ -272,10 +293,7 @@ const Editor = () => {
onInfo: onSDKInfo,
onWarning: onSDKWarning,
onError: onSDKError,
...(config.document.permissions.edit &&
config.document.permissions.modifyFilter && {
onRequestSharingSettings: onSDKRequestSharingSettings,
}),
onRequestSharingSettings,
},
};
@ -357,13 +375,14 @@ const Editor = () => {
{!isLoading ? (
<>
<div id="editor"></div>
<SharingDialog
isVisible={isVisible}
sharingObject={fileInfo}
onCancel={onCancel}
onSuccess={updateUsersRightsList}
/>
{fileInfo && (
<SharingDialog
isVisible={isVisible}
sharingObject={fileInfo}
onCancel={onCancel}
onSuccess={updateUsersRightsList}
/>
)}
</>
) : (
<Box paddingProp="16px">

View File

@ -1,6 +1,6 @@
{
"name": "@appserver/login",
"version": "0.1.7",
"version": "0.1.8",
"private": "true",
"homepage": "/login",
"title": "ONLYOFFICE",