Skip to content

Commit

Permalink
fix(orgAdmin): user should be able to remove themselves from the org (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tianrunhe authored Sep 9, 2024
1 parent 02544f9 commit 4368c0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/client/components/OrgAdminActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ export const OrgAdminActionMenu = (props: Props) => {
const {viewerId} = atmosphere
const {role, user} = organizationUser
const {id: userId} = user
const isSelf = viewerId === userId
const orgAdminCount = billingLeaders.filter(
(billingLeader) => billingLeader.role === 'ORG_ADMIN'
).length
const canEdit = isViewerOrgAdmin || (isViewerBillingLeaderPlus && role !== 'ORG_ADMIN')
const canEdit = isSelf || isViewerOrgAdmin || (isViewerBillingLeaderPlus && role !== 'ORG_ADMIN')
const isViewerLastOrgAdmin = isViewerOrgAdmin && orgAdminCount === 1
const isViewerLastRole = isViewerBillingLeaderPlus && billingLeaders.length === 1

Expand All @@ -80,7 +81,6 @@ export const OrgAdminActionMenu = (props: Props) => {

const isOrgAdmin = role === 'ORG_ADMIN'
const isBillingLeader = role === 'BILLING_LEADER'
const isSelf = viewerId === userId
const roleName = role === 'ORG_ADMIN' ? 'Org Admin' : 'Billing Leader'
const canRemoveRole =
role &&
Expand Down

0 comments on commit 4368c0b

Please sign in to comment.