Web: Payments page are hidden according to the condition.

This commit is contained in:
Tatiana Lopaeva 2023-05-08 16:42:50 +03:00
parent 47d57a870c
commit 80abcf982c
2 changed files with 31 additions and 2 deletions

View File

@ -241,7 +241,13 @@ class ArticleBodyContent extends React.Component {
catalogItems = () => {
const { selectedKeys } = this.state;
const { showText, isNotPaidPeriod, t, isOwner } = this.props;
const {
showText,
isNotPaidPeriod,
t,
isOwner,
isEnterpriseEdition,
} = this.props;
const items = [];
let resultTree = [...settingsTree];
@ -256,6 +262,12 @@ class ArticleBodyContent extends React.Component {
});
}
if (!isEnterpriseEdition) {
resultTree = [...settingsTree].filter((e) => {
return e.tKey !== "Common:PaymentsTitle";
});
}
if (!isOwner) {
const index = resultTree.findIndex((n) => n.tKey === "PortalDeletion");
if (index !== -1) {
@ -293,12 +305,13 @@ class ArticleBodyContent extends React.Component {
export default inject(({ auth, common }) => {
const { isLoadedArticleBody, setIsLoadedArticleBody } = common;
const { currentTariffStatusStore, userStore } = auth;
const { currentTariffStatusStore, userStore, isEnterpriseEdition } = auth;
const { isNotPaidPeriod } = currentTariffStatusStore;
const { user } = userStore;
const { isOwner } = user;
return {
isEnterpriseEdition,
showText: auth.settingsStore.showText,
toggleArticleOpen: auth.settingsStore.toggleArticleOpen,
isLoadedArticleBody,

View File

@ -31,6 +31,7 @@ const PrivateRoute = ({ component: Component, ...rest }) => {
withManager,
withCollaborator,
isLogout,
isEnterpriseEdition,
} = rest;
const { params, path } = computedMatch;
@ -137,6 +138,19 @@ const PrivateRoute = ({ component: Component, ...rest }) => {
);
}
if (isPaymentsUrl && !isEnterpriseEdition) {
return (
<Redirect
to={{
pathname: combineUrl(
window.DocSpaceConfig?.proxy?.url,
"/portal-settings/"
),
}}
/>
);
}
if (
isNotPaidPeriod &&
isLoaded &&
@ -242,6 +256,7 @@ export default inject(({ auth }) => {
settingsStore,
currentTariffStatusStore,
isLogout,
isEnterpriseEdition,
} = auth;
const { isNotPaidPeriod } = currentTariffStatusStore;
const { user } = userStore;
@ -254,6 +269,7 @@ export default inject(({ auth }) => {
} = settingsStore;
return {
isEnterpriseEdition,
isNotPaidPeriod,
user,
isAuthenticated,