From 1d6eb20a71c362eaf678c5d877268f2c37b38572 Mon Sep 17 00:00:00 2001 From: Scott Bishel Date: Wed, 11 Sep 2024 15:10:46 -0600 Subject: [PATCH] MM-58451 Add/Update Shared Channel indicator locations (#28130) * update shared channel sidebar * implement for direct channels --------- Co-authored-by: Mattermost Build --- .../src/components/searchable_channel_list.tsx | 17 +++++++++-------- .../sidebar_base_channel.test.tsx.snap | 6 ++---- .../sidebar_base_channel.tsx | 2 +- .../sidebar_base_channel_icon.tsx | 13 ------------- .../sidebar_channel_link.tsx | 11 +++++++++++ .../sidebar_direct_channel.test.tsx.snap | 4 ++++ .../sidebar_direct_channel.tsx | 1 + .../__snapshots__/user_profile.test.tsx.snap | 4 ---- .../components/user_profile/user_profile.tsx | 8 ++++++-- 9 files changed, 34 insertions(+), 32 deletions(-) diff --git a/webapp/channels/src/components/searchable_channel_list.tsx b/webapp/channels/src/components/searchable_channel_list.tsx index d59e1e24a9..a286d222db 100644 --- a/webapp/channels/src/components/searchable_channel_list.tsx +++ b/webapp/channels/src/components/searchable_channel_list.tsx @@ -129,14 +129,6 @@ export class SearchableChannelList extends React.PureComponent { if (isArchivedChannel(channel)) { channelTypeIcon = ; - } else if (channel.shared) { - channelTypeIcon = ( - - ); } else if (isPrivateChannel(channel)) { channelTypeIcon = ; } else { @@ -206,6 +198,14 @@ export class SearchableChannelList extends React.PureComponent { ); + const sharedChannelIcon = channel.shared ? ( + + ) : null; + return (
{
{channelTypeIcon} {channel.display_name} + {sharedChannelIcon}
{channelPurposeContainer}
diff --git a/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/__snapshots__/sidebar_base_channel.test.tsx.snap b/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/__snapshots__/sidebar_base_channel.test.tsx.snap index c90ecae0f0..ca99a4ddec 100644 --- a/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/__snapshots__/sidebar_base_channel.test.tsx.snap +++ b/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/__snapshots__/sidebar_base_channel.test.tsx.snap @@ -26,7 +26,6 @@ exports[`components/sidebar/sidebar_channel/sidebar_base_channel should match sn icon={ } label="channel_display_name" @@ -60,7 +59,6 @@ exports[`components/sidebar/sidebar_channel/sidebar_base_channel should match sn icon={ } label="channel_display_name" @@ -95,9 +93,9 @@ exports[`components/sidebar/sidebar_channel/sidebar_base_channel should match sn icon={ } + isSharedChannel={true} label="channel_display_name" link="/team_name/channels/" /> @@ -130,9 +128,9 @@ exports[`components/sidebar/sidebar_channel/sidebar_base_channel should match sn icon={ } + isSharedChannel={true} label="channel_display_name" link="/team_name/channels/" /> diff --git a/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/sidebar_base_channel.tsx b/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/sidebar_base_channel.tsx index 2bde4b43b7..c11bf99895 100644 --- a/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/sidebar_base_channel.tsx +++ b/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/sidebar_base_channel.tsx @@ -50,7 +50,6 @@ const SidebarBaseChannel = ({ const channelIcon = ( ); @@ -70,6 +69,7 @@ const SidebarBaseChannel = ({ ariaLabelPrefix={ariaLabelPrefix} channelLeaveHandler={channelLeaveHandler!} icon={channelIcon} + isSharedChannel={channel.shared} /> ); }; diff --git a/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/sidebar_base_channel_icon.tsx b/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/sidebar_base_channel_icon.tsx index 96d6a454f1..a8bfb2c380 100644 --- a/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/sidebar_base_channel_icon.tsx +++ b/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_base_channel/sidebar_base_channel_icon.tsx @@ -5,28 +5,15 @@ import React from 'react'; import type {ChannelType} from '@mattermost/types/channels'; -import SharedChannelIndicator from 'components/shared_channel_indicator'; - import Constants from 'utils/constants'; type Props = { - isSharedChannel: boolean; channelType: ChannelType; } const SidebarBaseChannelIcon = ({ - isSharedChannel, channelType, }: Props) => { - if (isSharedChannel) { - return ( - - ); - } if (channelType === Constants.OPEN_CHANNEL) { return ( diff --git a/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_channel_link/sidebar_channel_link.tsx b/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_channel_link/sidebar_channel_link.tsx index 77275a236b..46b3451d05 100644 --- a/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_channel_link/sidebar_channel_link.tsx +++ b/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_channel_link/sidebar_channel_link.tsx @@ -10,6 +10,7 @@ import type {Channel} from '@mattermost/types/channels'; import {mark, trackEvent} from 'actions/telemetry_actions'; import CustomStatusEmoji from 'components/custom_status/custom_status_emoji'; +import SharedChannelIndicator from 'components/shared_channel_indicator'; import {ChannelsAndDirectMessagesTour} from 'components/tours/onboarding_tour'; import WithTooltip from 'components/with_tooltip'; @@ -61,6 +62,7 @@ type Props = { hasUrgent: boolean; rhsState?: RhsState; rhsOpen?: boolean; + isSharedChannel?: boolean; actions: { markMostRecentPostInChannelAsUnread: (channelId: string) => void; @@ -223,6 +225,14 @@ export default class SidebarChannelLink extends React.PureComponent ) : null; + const sharedChannelIcon = this.props.isSharedChannel ? ( + + ) : null; + const content = ( <> + {sharedChannelIcon} } + isSharedChannel={false} label="channel_display_name" link="/team_name/messages/@some-user" teammateId="user_id" @@ -69,6 +70,7 @@ exports[`components/sidebar/sidebar_channel/sidebar_direct_channel should match wrapperClass="DirectChannel__profile-picture" /> } + isSharedChannel={false} label="channel_display_name" link="/team_name/messages/@some-user" teammateId="user_id" @@ -106,6 +108,7 @@ exports[`components/sidebar/sidebar_channel/sidebar_direct_channel should match wrapperClass="DirectChannel__profile-picture" /> } + isSharedChannel={false} label="channel_display_name (you)" link="/team_name/messages/@some-user" teammateId="user_id" @@ -139,6 +142,7 @@ exports[`components/sidebar/sidebar_channel/sidebar_direct_channel should match className="icon icon-archive-outline" /> } + isSharedChannel={false} label="channel_display_name" link="/team_name/messages/@some-user" teammateId="user_id" diff --git a/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_direct_channel/sidebar_direct_channel.tsx b/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_direct_channel/sidebar_direct_channel.tsx index c7fd09ba2c..5c298c86a0 100644 --- a/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_direct_channel/sidebar_direct_channel.tsx +++ b/webapp/channels/src/components/sidebar/sidebar_channel/sidebar_direct_channel/sidebar_direct_channel.tsx @@ -110,6 +110,7 @@ class SidebarDirectChannel extends React.PureComponent { label={displayName} channelLeaveHandler={this.handleLeaveChannel} icon={this.getIcon()} + isSharedChannel={teammate.remote_id !== undefined} /> ); } diff --git a/webapp/channels/src/components/user_profile/__snapshots__/user_profile.test.tsx.snap b/webapp/channels/src/components/user_profile/__snapshots__/user_profile.test.tsx.snap index 317b2da62e..a47cf0718d 100644 --- a/webapp/channels/src/components/user_profile/__snapshots__/user_profile.test.tsx.snap +++ b/webapp/channels/src/components/user_profile/__snapshots__/user_profile.test.tsx.snap @@ -50,10 +50,6 @@ exports[`components/UserProfile should match snapshot, when user is shared 1`] = > nickname - `; diff --git a/webapp/channels/src/components/user_profile/user_profile.tsx b/webapp/channels/src/components/user_profile/user_profile.tsx index 8be4284507..740a67a5b0 100644 --- a/webapp/channels/src/components/user_profile/user_profile.tsx +++ b/webapp/channels/src/components/user_profile/user_profile.tsx @@ -31,7 +31,6 @@ export default function UserProfile({ userId, channelId, overwriteIcon, - isShared, }: Props) { let name: ReactNode; if (user && displayUsername) { @@ -62,8 +61,12 @@ export default function UserProfile({ } let profileImg = ''; + let userIsRemote = false; if (user) { profileImg = imageURLForUser(user.id, user.last_picture_update); + if (user.remote_id) { + userIsRemote = true; + } } return ( @@ -81,10 +84,11 @@ export default function UserProfile({ > {name} - {(isShared) && + {userIsRemote && } {(user && user.is_bot) && }