Web: Hid upgrade button in dialog for room admin.

This commit is contained in:
Tatiana Lopaeva 2023-03-13 17:23:36 +03:00
parent ac0f8feae9
commit 696b6504fc
3 changed files with 19 additions and 7 deletions

View File

@ -27,6 +27,7 @@ const InviteUsersWarningDialog = (props) => {
setIsVisible,
isGracePeriod,
currentTariffPlanTitle,
isPaymentPageAvailable,
} = props;
const [datesData, setDatesData] = useState({});
@ -107,10 +108,12 @@ const InviteUsersWarningDialog = (props) => {
<ModalDialog.Footer>
<Button
key="OkButton"
label={t("UpgradePlan")}
label={
isPaymentPageAvailable ? t("UpgradePlan") : t("Common:OKButton")
}
size="normal"
primary
onClick={onUpgradePlan}
onClick={isPaymentPageAvailable ? onUpgradePlan : onClose}
scale
/>
<Button
@ -126,6 +129,7 @@ const InviteUsersWarningDialog = (props) => {
};
export default inject(({ auth, dialogsStore }) => {
const { isPaymentPageAvailable } = auth;
const {
dueDate,
delayDueDate,
@ -139,6 +143,7 @@ export default inject(({ auth, dialogsStore }) => {
} = dialogsStore;
return {
isPaymentPageAvailable,
currentTariffPlanTitle,
language: auth.language,
visible: inviteUsersWarningDialogVisible,

View File

@ -34,7 +34,7 @@ const Article = ({
hideProfileBlock,
isFreeTariff,
isAvailableArticlePaymentAlert,
isPaymentPageAvailable,
currentColorScheme,
setArticleOpen,
...rest
@ -136,7 +136,7 @@ const Article = ({
{!hideProfileBlock && !isMobileOnly && (
<ArticleProfile showText={showText} />
)}
{isAvailableArticlePaymentAlert &&
{isPaymentPageAvailable &&
(isFreeTariff || isGracePeriod) &&
showText && (
<ArticlePaymentAlert
@ -205,14 +205,13 @@ export default inject(({ auth }) => {
currentQuotaStore,
currentTariffStatusStore,
userStore,
isPaymentPageAvailable,
} = auth;
const { isFreeTariff } = currentQuotaStore;
const { isGracePeriod } = currentTariffStatusStore;
const { user } = userStore;
const isAvailableArticlePaymentAlert = user.isOwner || user.isAdmin;
const {
showText,
setShowText,
@ -233,7 +232,7 @@ export default inject(({ auth }) => {
toggleArticleOpen,
isFreeTariff,
isGracePeriod,
isAvailableArticlePaymentAlert,
isPaymentPageAvailable,
currentColorScheme,
setArticleOpen,
};

View File

@ -134,6 +134,14 @@ class AuthStore {
return !user.isAdmin && !user.isOwner && !user.isVisitor;
}
get isPaymentPageAvailable() {
const { user } = this.userStore;
if (!user) return false;
return user.isOwner || user.isAdmin;
}
login = async (user, hash, session = true) => {
try {
const response = await api.user.login(user, hash, session);