Skip to content

Commit

Permalink
fix(core): only team workspace can assign admin
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmFly committed Dec 18, 2024
1 parent 3b8c2bb commit 5cc037d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@affine/core/modules/permissions';
import { Permission, WorkspaceMemberStatus } from '@affine/graphql';
import { useI18n } from '@affine/i18n';
import { useService } from '@toeverything/infra';
import { useLiveData, useService } from '@toeverything/infra';
import { useCallback, useMemo } from 'react';

export const MemberOptions = ({
Expand All @@ -23,6 +23,7 @@ export const MemberOptions = ({
const t = useI18n();
const membersService = useService(WorkspaceMembersService);
const permission = useService(WorkspacePermissionService).permission;
const isTeam = useLiveData(permission.isTeam$);
const { openConfirmModal } = useConfirmModal();

const openRemoveConfirmModal = useCallback(
Expand Down Expand Up @@ -207,6 +208,7 @@ export const MemberOptions = ({
label: t['com.affine.payment.member.team.change.admin'](),
onClick: handleChangeToAdmin,
show:
isTeam &&
isOwner &&
member.permission !== Permission.Owner &&
member.permission !== Permission.Admin &&
Expand All @@ -228,6 +230,7 @@ export const MemberOptions = ({
handleRevoke,
isAdmin,
isOwner,
isTeam,
member,
t,
]);
Expand Down

0 comments on commit 5cc037d

Please sign in to comment.