Skip to content

Commit

Permalink
fix(core): member options in member list do not match expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmFly committed Dec 18, 2024
1 parent 5cc037d commit a3c1118
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,30 @@ export const MemberList = ({
);
};

const getShouldShow = ({
member,
currentAccountId,
isOwner,
isAdmin,
}: {
member: Member;
currentAccountId: string;
isOwner: boolean;
isAdmin: boolean;
}) => {
if (
member.id === currentAccountId ||
member.permission === Permission.Owner
) {
return false;
} else if (isOwner) {
return true;
} else if (isAdmin) {
return member.permission !== Permission.Admin;
}
return false;
};

const MemberItem = ({
member,
isOwner,
Expand All @@ -122,7 +146,16 @@ const MemberItem = ({
const permission = useService(WorkspacePermissionService).permission;
const isEquals = workspaceName === inputValue;

const show = isOwner && currentAccount.id !== member.id;
const show = useMemo(
() =>
getShouldShow({
member,
currentAccountId: currentAccount.id,
isOwner,
isAdmin,
}),
[member, currentAccount, isOwner, isAdmin]
);

const handleOpenAssignModal = useCallback(() => {
setInputValue('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ export class Subscription extends Entity {
? subscriptions.find(sub => sub.plan === SubscriptionPlan.AI)
: null
);
team$ = this.subscription$.map(subscriptions =>
subscriptions
? subscriptions.find(sub => sub.plan === SubscriptionPlan.Team)
: null
);
isBeliever$ = this.pro$.map(
sub => sub?.recurring === SubscriptionRecurring.Lifetime
);
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/i18n/src/resources/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@
"com.affine.payment.cloud.team-workspace.benefit.g1-3": "500 MB of maximum file size.",
"com.affine.payment.cloud.team-workspace.benefit.g1-4": "Unlimited team members (10+ seats).",
"com.affine.payment.cloud.team-workspace.benefit.g1-5": "Multiple admin roles.",
"com.affine.payment.cloud.team-workspace.benefit.g1-6": "Priority customer support",
"com.affine.payment.cloud.team-workspace.benefit.g1-6": "Priority customer support.",
"com.affine.payment.cloud.team-workspace.description": "Best for scalable teams.",
"com.affine.payment.cloud.team-workspace.name": "Team Workspace",
"com.affine.payment.cloud.team-workspace.title.billed-yearly": "annually",
Expand Down

0 comments on commit a3c1118

Please sign in to comment.