Merge branch 'feature/workspaces' of github.com:ONLYOFFICE/AppServer into feature/workspaces

This commit is contained in:
TatianaLopaeva 2021-03-22 21:10:23 +03:00
commit 6bb12c9524
12 changed files with 64 additions and 45 deletions

View File

@ -104,6 +104,15 @@ export function sendRegisterRequest(email) {
});
}
export function sendOwnerChange(ownerId) {
const data = { ownerId };
return request({
method: "post",
url: `/settings/owner.json`,
data,
});
}
export function getMachineName(confirmKey = null) {
const options = {
method: "get",

View File

@ -6,10 +6,12 @@ import DropDownItem from "@appserver/components/drop-down-item";
import { withTranslation } from "react-i18next";
import { isMobile } from "react-device-detect";
import Loaders from "@appserver/common/components/Loaders";
import { FileAction } from "@appserver/common/constants";
import { FileAction, AppServerConfig } from "@appserver/common/constants";
import { encryptionUploadDialog } from "../../../helpers/desktop";
import { inject, observer } from "mobx-react";
import config from "../../../../package.json";
import { combineUrl } from "@appserver/common/utils";
class PureArticleMainButtonContent extends React.Component {
onCreate = (e) => {
// this.goToHomePage();
@ -39,7 +41,9 @@ class PureArticleMainButtonContent extends React.Component {
goToHomePage = () => {
const { homepage, history, filter } = this.props;
const urlFilter = filter.toUrlParams();
history.push(`${homepage}/filter?${urlFilter}`);
history.push(
combineUrl(AppServerConfig.proxyURL, homepage, `/filter?${urlFilter}`)
);
};
onFileChange = (e) => {

View File

@ -393,7 +393,9 @@ class FilesRowContent extends React.PureComponent {
fetchFileVersions(item.id + "");
setIsVerHistoryPanel(true);
} else {
history.push(`${homepage}/${item.id}/history`);
history.push(
combineUrl(AppServerConfig.proxyURL, homepage, `/${item.id}/history`)
);
}
};

View File

@ -10,9 +10,10 @@ import Row from "@appserver/components/row";
import FilesRowContent from "./FilesRowContent";
import { withRouter } from "react-router-dom";
import toastr from "studio/toastr";
import { FileAction } from "@appserver/common/constants";
import { FileAction, AppServerConfig } from "@appserver/common/constants";
import copy from "copy-to-clipboard";
import config from "../../../../../../../package.json";
import { combineUrl } from "@appserver/common/utils";
const StyledSimpleFilesRow = styled(Row)`
margin-top: -2px;
@ -190,7 +191,9 @@ const SimpleFilesRow = (props) => {
fetchFileVersions(id + "");
setIsVerHistoryPanel(true);
} else {
history.push(`${homepage}/${id}/history`);
history.push(
combineUrl(AppServerConfig.proxyURL, homepage, `/${id}/history`)
);
}
};

View File

@ -6,7 +6,7 @@ import Badge from "@appserver/components/badge";
import Link from "@appserver/components/link";
import Text from "@appserver/components/text";
import { markAsRead } from "@appserver/common/api/files";
import { FileAction } from "@appserver/common/constants";
import { FileAction, AppServerConfig } from "@appserver/common/constants";
import toastr from "studio/toastr";
import { getTitleWithoutExst } from "../../../../../helpers/files-helpers";
import { NewFilesPanel } from "../../../../panels";
@ -17,6 +17,7 @@ import { inject, observer } from "mobx-react";
import CheckIcon from "../../../../../../public/images/check.react.svg";
import CrossIcon from "../../../../../../../../../public/images/cross.react.svg";
import config from "../../../../../../package.json";
import { combineUrl } from "@appserver/common/utils";
const SimpleFilesTileContent = styled(TileContent)`
.rowMainContainer {
@ -282,7 +283,9 @@ class FilesTileContent extends React.PureComponent {
const { homepage, history } = this.props;
const fileId = e.currentTarget.dataset.id;
history.push(`${homepage}/${fileId}/history`);
history.push(
combineUrl(AppServerConfig.proxyURL, homepage, `/${fileId}/history`)
);
};
onBadgeClick = () => {

View File

@ -15,9 +15,9 @@ namespace ASC.Files.Core.EF
{
public static class Tables
{
public const string File = "file";
public const string Tree = "tree";
public const string Folder = "folder";
public const string File = "files_file";
public const string Tree = "files_folder_tree";
public const string Folder = "files_folder";
}
[Transient]

View File

@ -11,7 +11,6 @@ import Text from "@appserver/components/text";
import { withTranslation } from "react-i18next";
import ModalDialogContainer from "../ModalDialogContainer";
import copy from "copy-to-clipboard";
// import { getShortenedLink } from "@appserver/common/api/portal";
import { inject, observer } from "mobx-react";
const textAreaName = "link-textarea";
@ -78,24 +77,19 @@ class InviteDialogComponent extends React.Component {
guestInvitationLink,
} = this.props;
getShortenedLink(userInvitationLink, true)
//.then((link) => this.setState({ userInvitationLink: link }))
.catch((e) => {
console.error("getShortInvitationLink error", e);
this.setState({ isLoading: false });
});
const { isGuest } = this.state;
const link = isGuest ? guestInvitationLink : userInvitationLink;
getShortenedLink(guestInvitationLink)
.then(() =>
this.setState({
// guestInvitationLink: link,
isLoading: false,
isLinkShort: true,
})
)
.catch((e) => {
console.error("getShortInvitationLink error", e);
});
getShortenedLink(link, !isGuest)
.then((link) => {
if (!isGuest) {
this.setState({ userInvitationLink: link, isLinkShort: true });
} else {
this.setState({ guestInvitationLink: link, isLinkShort: true });
}
})
.catch((e) => console.error("getShortInvitationLink error", e)) // TODO: add translation
.finally(() => this.setState({ isLoading: false }));
};
componentDidMount() {

View File

@ -1,8 +1,6 @@
import React, { Suspense, lazy } from "react";
import React, { lazy } from "react";
import { Route, Switch } from "react-router-dom";
import ConfirmRoute from "../../../helpers/confirmRoute";
import { Error404, PageLayout, Loaders } from "@appserver/common";
import { inject, observer } from "mobx-react";
const ActivateUserForm = lazy(() => import("./sub-components/activateUser"));
const CreateUserForm = lazy(() => import("./sub-components/createUser"));
@ -15,7 +13,7 @@ const ChangePhoneForm = lazy(() => import("./sub-components/changePhone"));
const ProfileRemoveForm = lazy(() => import("./sub-components/profileRemove"));
const ChangeOwnerForm = lazy(() => import("./sub-components/changeOwner"));
const Confirm = ({ match, isLoaded }) => {
const Confirm = ({ match }) => {
//console.log("Confirm render");
return (
<Switch>
@ -39,7 +37,7 @@ const Confirm = ({ match, isLoaded }) => {
path={`${match.path}/EmailChange`}
component={ChangeEmailForm}
/>
<ConfirmRoute
<Route
forUnauthorized
path={`${match.path}/PasswordChange`}
component={ChangePasswordForm}
@ -54,9 +52,9 @@ const Confirm = ({ match, isLoaded }) => {
path={`${match.path}/PhoneActivation`}
component={ChangePhoneForm}
/>
<Route
<ConfirmRoute
exact
path={`${match.path}/ownerchange`}
path={`${match.path}/PortalOwnerChange`}
component={ChangeOwnerForm}
/>
{/* <Route component={Error404} /> */}
@ -64,9 +62,4 @@ const Confirm = ({ match, isLoaded }) => {
);
};
export default inject(({ auth }) => {
const { isLoaded } = auth;
return {
isLoaded,
};
})(observer(Confirm));
export default Confirm;

View File

@ -387,5 +387,6 @@ export default inject(({ auth }) => {
defaultPage,
getSettings,
getPortalPasswordSettings,
login: auth.login,
};
})(withRouter(withTranslation("Confirm")(observer(ActivateUserForm))));

View File

@ -98,8 +98,12 @@ class PureOwnerSettings extends Component {
}
onChangeOwner = () => {
const { t, owner } = this.props;
toastr.success(t("DnsChangeMsg", { email: owner.email }));
const { t, owner, sendOwnerChange } = this.props;
debugger;
const { selectedOwner } = this.state;
sendOwnerChange(selectedOwner.id)
.then((res) => toastr.success(res.message)) //toastr.success(t("DnsChangeMsg", { email: owner.email })))
.catch((err) => toastr.error(err));
};
onLoading = (status) => this.setState({ isLoading: status });
@ -236,12 +240,14 @@ OwnerSettings.propTypes = {
owner: PropTypes.object,
};
export default inject(({ auth }) => {
export default inject(({ auth, setup }) => {
const { customNames, getPortalOwner, owner } = auth.settingsStore;
const { sendOwnerChange } = setup;
return {
groupsCaption: customNames.groupsCaption,
getPortalOwner,
owner,
me: auth.userStore.user,
sendOwnerChange,
};
})(withRouter(OwnerSettings));

View File

@ -168,6 +168,10 @@ class SettingsSetupStore {
changePassword = (userId, hash, key) => {
return api.people.changePassword(userId, hash, key);
};
sendOwnerChange = (id) => {
return api.settings.sendOwnerChange(id);
};
}
export default SettingsSetupStore;

View File

@ -218,7 +218,7 @@ namespace ASC.Web.Studio.Core.Notify
public void SendEmailActivationInstructions(UserInfo user, string email)
{
var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(email, ConfirmType.EmailActivation, null, AuthContext.CurrentAccount.ID);
var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(email, ConfirmType.EmailActivation, null, user.ID);
static string greenButtonText() => WebstudioNotifyPatternResource.ButtonActivateEmail;