Skip to content

Commit

Permalink
fix: Do not allow non admin to remove services from conversations (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
atomrc authored Oct 10, 2023
1 parent 72c4600 commit 3e70e04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ interface GroupParticipantServiceProps {
activeConversation: Conversation;
actionsViewModel: ActionsViewModel;
integrationRepository: IntegrationRepository;
enableRemove: boolean;
goToRoot: () => void;
onBack: () => void;
onClose: () => void;
Expand All @@ -54,6 +55,7 @@ const GroupParticipantService: FC<GroupParticipantServiceProps> = ({
activeConversation,
actionsViewModel,
integrationRepository,
enableRemove,
goToRoot,
onBack,
onClose,
Expand All @@ -69,7 +71,7 @@ const GroupParticipantService: FC<GroupParticipantServiceProps> = ({
} = useKoSubscribableChildren(activeConversation, ['inTeam', 'isActiveParticipant', 'participating_user_ids']);
const {teamRole} = useKoSubscribableChildren(selfUser, ['teamRole']);

const {canChatWithServices, canUpdateGroupParticipants} = generatePermissionHelpers(teamRole);
const {canChatWithServices} = generatePermissionHelpers(teamRole);

const selectedInConversation = participatingUserIds.some(user => matchQualifiedIds(userEntity, user));

Expand Down Expand Up @@ -117,7 +119,7 @@ const GroupParticipantService: FC<GroupParticipantServiceProps> = ({
</div>
)}

{showActions && canUpdateGroupParticipants() && (
{showActions && enableRemove && (
<div
role="button"
tabIndex={TabIndex.FOCUSABLE}
Expand Down
1 change: 1 addition & 0 deletions src/script/page/RightSidebar/RightSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ const RightSidebar: FC<RightSidebarProps> = ({
activeConversation={activeConversation}
actionsViewModel={actionsViewModel}
integrationRepository={integrationRepository}
enableRemove={conversationRoleRepository.canRemoveParticipants(activeConversation)}
goToRoot={goToRoot}
onBack={onBackClick}
onClose={closePanel}
Expand Down

0 comments on commit 3e70e04

Please sign in to comment.