mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-28 23:53:38 -05:00
Merge pull request #13916 from overleaf/bg-managed-users-hide-leave-group-action
managed users hide leave group action GitOrigin-RevId: 160e31e6935cd3737356714020e057f8c1acc5b8
This commit is contained in:
parent
d298a258e0
commit
558992d947
6 changed files with 23 additions and 7 deletions
|
@ -297,6 +297,8 @@ async function userSubscriptionPage(req, res) {
|
||||||
cancelButtonNewCopy,
|
cancelButtonNewCopy,
|
||||||
groupPlans: groupPlansDataForDash,
|
groupPlans: groupPlansDataForDash,
|
||||||
groupSettingsEnabledFor,
|
groupSettingsEnabledFor,
|
||||||
|
isManagedAccount: !!req.managedBy,
|
||||||
|
userRestrictions: Array.from(req.userRestrictions || []),
|
||||||
}
|
}
|
||||||
res.render('subscriptions/dashboard-react', data)
|
res.render('subscriptions/dashboard-react', data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ module.exports = {
|
||||||
webRouter.get(
|
webRouter.get(
|
||||||
'/user/subscription',
|
'/user/subscription',
|
||||||
AuthenticationController.requireLogin(),
|
AuthenticationController.requireLogin(),
|
||||||
|
PermissionsController.useCapabilities(),
|
||||||
SubscriptionController.userSubscriptionPage
|
SubscriptionController.userSubscriptionPage
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ async function settingsPage(req, res) {
|
||||||
showPersonalAccessToken,
|
showPersonalAccessToken,
|
||||||
personalAccessTokens,
|
personalAccessTokens,
|
||||||
emailAddressLimit: Settings.emailAddressLimit,
|
emailAddressLimit: Settings.emailAddressLimit,
|
||||||
isManagedAccount: !!user.enrollment?.managedBy,
|
isManagedAccount: !!req.managedBy,
|
||||||
userRestrictions: Array.from(req.userRestrictions || []),
|
userRestrictions: Array.from(req.userRestrictions || []),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ html(
|
||||||
indexName : settings.templates.indexName
|
indexName : settings.templates.indexName
|
||||||
})
|
})
|
||||||
|
|
||||||
|
meta(name="ol-isManagedAccount" data-type="boolean" content=isManagedAccount)
|
||||||
each restriction in userRestrictions || []
|
each restriction in userRestrictions || []
|
||||||
meta(name='ol-cannot-' + restriction data-type="boolean" content=true)
|
meta(name='ol-cannot-' + restriction data-type="boolean" content=true)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ block append meta
|
||||||
meta(name="ol-showPersonalAccessToken", data-type="boolean" content=showPersonalAccessToken)
|
meta(name="ol-showPersonalAccessToken", data-type="boolean" content=showPersonalAccessToken)
|
||||||
meta(name="ol-personalAccessTokens", data-type="json" content=personalAccessTokens)
|
meta(name="ol-personalAccessTokens", data-type="json" content=personalAccessTokens)
|
||||||
meta(name="ol-emailAddressLimit", data-type="json", content=emailAddressLimit)
|
meta(name="ol-emailAddressLimit", data-type="json", content=emailAddressLimit)
|
||||||
meta(name="ol-isManagedAccount" data-type="boolean" content=isManagedAccount)
|
|
||||||
|
|
||||||
block content
|
block content
|
||||||
main.content.content-alt#settings-page-root
|
main.content.content-alt#settings-page-root
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { MemberGroupSubscription } from '../../../../../../types/subscription/da
|
||||||
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
|
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
|
||||||
import { LEAVE_GROUP_MODAL_ID } from './leave-group-modal'
|
import { LEAVE_GROUP_MODAL_ID } from './leave-group-modal'
|
||||||
import PremiumFeaturesLink from './premium-features-link'
|
import PremiumFeaturesLink from './premium-features-link'
|
||||||
|
import getMeta from '../../../../utils/meta.js'
|
||||||
|
|
||||||
type GroupSubscriptionMembershipProps = {
|
type GroupSubscriptionMembershipProps = {
|
||||||
subscription: MemberGroupSubscription
|
subscription: MemberGroupSubscription
|
||||||
|
@ -23,6 +24,11 @@ export default function GroupSubscriptionMembership({
|
||||||
setLeavingGroupId(subscription._id)
|
setLeavingGroupId(subscription._id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide leave group button for managed users
|
||||||
|
const hideLeaveButton = getMeta(
|
||||||
|
'ol-cannot-leave-group-subscription'
|
||||||
|
) as boolean
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
|
@ -43,11 +49,18 @@ export default function GroupSubscriptionMembership({
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{isLast && <PremiumFeaturesLink />}
|
{isLast && <PremiumFeaturesLink />}
|
||||||
|
{hideLeaveButton ? (
|
||||||
|
<span>
|
||||||
|
{' '}
|
||||||
|
{t('need_to_leave')} {t('contact_group_admin')}{' '}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
<span>
|
<span>
|
||||||
<Button bsStyle="danger" onClick={leaveGroup}>
|
<Button bsStyle="danger" onClick={leaveGroup}>
|
||||||
{t('leave_group')}
|
{t('leave_group')}
|
||||||
</Button>
|
</Button>
|
||||||
</span>
|
</span>
|
||||||
|
)}
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue