diff --git a/frontend/src/components/group/GroupJoinButton.tsx b/frontend/src/components/group/GroupJoinButton.tsx index bb4ee7f..6066648 100644 --- a/frontend/src/components/group/GroupJoinButton.tsx +++ b/frontend/src/components/group/GroupJoinButton.tsx @@ -15,6 +15,8 @@ export interface GroupJoinButtonProps { export function GroupJoinButton({resource}: GroupJoinButtonProps): JSX.Element | null { const authorization = useAuthorizationContext() + const trueMembers = [resource.value.owner, ...resource.value.members] + const doJoin = React.useCallback( async () => { @@ -29,7 +31,7 @@ export function GroupJoinButton({resource}: GroupJoinButtonProps): JSX.Element | if(!authorization.state.user) { return null } - if(resource.value.members.includes(authorization.state.user.id)) { + if(trueMembers.includes(authorization.state.user.id)) { return null } diff --git a/frontend/src/components/group/GroupLeaveButton.tsx b/frontend/src/components/group/GroupLeaveButton.tsx index 8c96c14..078ff49 100644 --- a/frontend/src/components/group/GroupLeaveButton.tsx +++ b/frontend/src/components/group/GroupLeaveButton.tsx @@ -15,6 +15,8 @@ export interface GroupLeaveButtonProps { export function GroupLeaveButton({resource}: GroupLeaveButtonProps): JSX.Element | null { const authorization = useAuthorizationContext() + const trueMembers = [resource.value.owner, ...resource.value.members] + const doLeave = React.useCallback( async () => { @@ -29,7 +31,7 @@ export function GroupLeaveButton({resource}: GroupLeaveButtonProps): JSX.Element if(!authorization.state.user) { return null } - if(!resource.value.members.includes(authorization.state.user.id)) { + if(!trueMembers.includes(authorization.state.user.id)) { return null } diff --git a/frontend/src/components/group/GroupResourcePanel.tsx b/frontend/src/components/group/GroupResourcePanel.tsx index 42c485d..f8d2fa1 100644 --- a/frontend/src/components/group/GroupResourcePanel.tsx +++ b/frontend/src/components/group/GroupResourcePanel.tsx @@ -16,7 +16,8 @@ export interface GroupResourcePanelProps { export function GroupResourcePanel({resource}: GroupResourcePanelProps): JSX.Element { const icon = resource.value.access === "OPEN" ? faGlobe : faEnvelope - const members = resource.value.members.length + + const trueMembers = [resource.value.owner, ...resource.value.members] return ( @@ -29,7 +30,7 @@ export function GroupResourcePanel({resource}: GroupResourcePanelProps): JSX.Ele - {members} member{members !== 1 ? "s" : ""} + {trueMembers.length} member{trueMembers.length !== 1 ? "s" : ""}