Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ const defaultComponents = {
return (
<ContextMenuButton
aria-label={behaviorProps.title}
data-testid='dropdown-action-archive'
Icon={IconArchive}
{...behaviorProps}
>
Expand All @@ -176,6 +177,7 @@ const defaultComponents = {
return (
<ContextMenuButton
aria-label={title}
data-testid='dropdown-action-ban'
disabled={inProgress}
Icon={IconNoSign}
onClick={async () => {
Expand Down Expand Up @@ -244,6 +246,7 @@ const defaultComponents = {
return (
<ContextMenuButton
aria-label={title}
data-testid='dropdown-action-leave'
disabled={inProgress}
Icon={IconLeave}
onClick={async (e) => {
Expand Down Expand Up @@ -290,6 +293,7 @@ const defaultComponents = {
return (
<ContextMenuButton
aria-label={behaviorProps.title}
data-testid='dropdown-action-mute'
Icon={IconMute}
{...behaviorProps}
>
Expand All @@ -314,6 +318,7 @@ const defaultComponents = {
return (
<ContextMenuButton
aria-label={title}
data-testid='dropdown-action-pin'
disabled={inProgress}
Icon={IconPin}
onClick={async (e) => {
Expand Down Expand Up @@ -377,6 +382,7 @@ const defaultComponents = {
appearance='ghost'
aria-label={behaviorProps.title}
circular
data-testid='quick-action-archive'
size='sm'
variant='secondary'
{...behaviorProps}
Expand All @@ -393,6 +399,7 @@ const defaultComponents = {
appearance='ghost'
aria-label={behaviorProps.title}
circular
data-testid='quick-action-mute'
size='sm'
variant='secondary'
{...behaviorProps}
Expand All @@ -418,6 +425,7 @@ const defaultComponents = {
aria-expanded={dialogIsOpen}
aria-pressed={dialogIsOpen}
circular
data-testid='channel-list-item-dropdown-toggle'
onClick={(e) => {
e.stopPropagation();

Expand Down Expand Up @@ -472,6 +480,7 @@ export const useBaseChannelActionSetFilter = (channelActionSet: ChannelActionIte
const membership = useChannelMembershipState(channel);
const memberCount = channel.data?.member_count ?? 0;
const connectedUserIsMember = typeof membership.user !== 'undefined';
const isDirectMessageChannel = connectedUserIsMember && memberCount === 2;

const ownCapabilities = channel.data?.own_capabilities;

Expand All @@ -486,9 +495,7 @@ export const useBaseChannelActionSetFilter = (channelActionSet: ChannelActionIte
return ownCapabilities?.includes('mute-channel');
case 'ban':
return (
memberCount > 0 &&
memberCount <= 2 &&
ownCapabilities?.includes('ban-channel-members')
isDirectMessageChannel && ownCapabilities?.includes('ban-channel-members')
);
case 'leave':
return ownCapabilities?.includes('leave-channel');
Expand All @@ -500,5 +507,5 @@ export const useBaseChannelActionSetFilter = (channelActionSet: ChannelActionIte
});

return filtered;
}, [channelActionSet, memberCount, ownCapabilities, connectedUserIsMember]);
}, [channelActionSet, connectedUserIsMember, ownCapabilities, isDirectMessageChannel]);
};
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const ChannelListItemActionButtons: ChannelListItemActionButtonsInterface
className={clsx('str-chat__channel-list-item__action-buttons', {
'str-chat__channel-list-item__action-buttons--active': dialogIsOpen,
})}
data-testid='channel-list-item-action-buttons'
>
{quickDropdownToggleAction && dropdownActionSet.length > 0 && (
<quickDropdownToggleAction.Component ref={setReferenceElement} />
Expand All @@ -53,6 +54,7 @@ export const ChannelListItemActionButtons: ChannelListItemActionButtonsInterface
))}
<ContextMenuComponent
className='str-chat__channel-list-item__action-buttons-context-menu'
data-testid='channel-list-item-context-menu'
dialogManagerId={dialogManager?.id}
id={dialog.id}
onClose={dialog?.close}
Expand Down
Loading
Loading