diff --git a/webapp/channels/src/components/channel_header/__snapshots__/channel_header.test.tsx.snap b/webapp/channels/src/components/channel_header/__snapshots__/channel_header.test.tsx.snap index 1422ed4f5e..c3442ff8a5 100644 --- a/webapp/channels/src/components/channel_header/__snapshots__/channel_header.test.tsx.snap +++ b/webapp/channels/src/components/channel_header/__snapshots__/channel_header.test.tsx.snap @@ -594,6 +594,7 @@ exports[`components/ChannelHeader should render active channel files 1`] = ` ariaLabel={true} buttonClass="member-rhs__trigger channel-header__icon channel-header__icon--left channel-header__icon--wide" buttonId="member_rhs" + disabled={false} iconComponent={ { } = this.props; const {formatMessage} = this.props.intl; const ariaLabelChannelHeader = this.props.intl.formatMessage({id: 'accessibility.sections.channelHeader', defaultMessage: 'channel header region'}); - let showMeetBtn = true; + let showMeetBtn = !isEmptyObject(channelMember); let hasGuestsText: ReactNode = ''; if (hasGuests) { @@ -293,39 +293,13 @@ class ChannelHeader extends React.PureComponent { ); } - if (isEmptyObject(channelMember) && !isGuest(dmUser?.roles ?? '')) { // light header for the preview mode feature - return ( - - ); - } const channelIsArchived = channel.delete_at !== 0; - if (isEmptyObject(channel) || - isEmptyObject(channelMember) || - isEmptyObject(currentUser) || + + // Infomaniak: skip for channel previews + // isEmptyObject(channel) || + // isEmptyObject(channelMember) || + // isEmptyObject(currentUser) || + if ( (!dmUser && channel.type === Constants.DM_CHANNEL) ) { // Use an empty div to make sure the header's height stays constant @@ -426,6 +400,7 @@ class ChannelHeader extends React.PureComponent { if (!isDirect) { const membersIconClass = classNames('member-rhs__trigger channel-header__icon channel-header__icon--left channel-header__icon--wide', { 'channel-header__icon--active': rhsState === RHSStates.CHANNEL_MEMBERS, + disabled: isEmptyObject(channelMember), }); const membersIcon = this.props.memberCount ? ( <> @@ -457,11 +432,12 @@ class ChannelHeader extends React.PureComponent { memberListButton = ( {} : this.toggleChannelMembersRHS} tooltipKey={'channelMembers'} /> ); @@ -562,7 +538,7 @@ class ChannelHeader extends React.PureComponent { ); } else { let editMessage; - if (!isReadOnly && !channelIsArchived) { + if (!isReadOnly && !channelIsArchived && !isEmptyObject(channelMember)) { if (isDirect || isGroup) { if (!isDirect || !dmUser?.is_bot) { editMessage = ( @@ -703,7 +679,7 @@ class ChannelHeader extends React.PureComponent { channelMember={channelMember} /> {showMeetBtn && } - + {!isEmptyObject(channelMember) && } ); diff --git a/webapp/channels/src/components/channel_header/channel_header_title.tsx b/webapp/channels/src/components/channel_header/channel_header_title.tsx index ffbe242ebe..08718cd0e5 100644 --- a/webapp/channels/src/components/channel_header/channel_header_title.tsx +++ b/webapp/channels/src/components/channel_header/channel_header_title.tsx @@ -9,7 +9,7 @@ import {useSelector} from 'react-redux'; import type {UserProfile} from '@mattermost/types/users'; -import {getCurrentChannel} from 'mattermost-redux/selectors/entities/channels'; +import {getCurrentChannel, getMyCurrentChannelMembership} from 'mattermost-redux/selectors/entities/channels'; import {ChannelHeaderDropdown} from 'components/channel_header_dropdown'; import SharedChannelIndicator from 'components/shared_channel_indicator'; @@ -18,6 +18,7 @@ import MenuWrapper from 'components/widgets/menu/menu_wrapper'; import BotTag from 'components/widgets/tag/bot_tag'; import {Constants} from 'utils/constants'; +import {isEmptyObject} from 'utils/utils'; import ChannelHeaderTitleDirect from './channel_header_title_direct'; import ChannelHeaderTitleFavorite from './channel_header_title_favorite'; @@ -35,6 +36,7 @@ const ChannelHeaderTitle = ({ const [titleMenuOpen, setTitleMenuOpen] = useState(false); const intl = useIntl(); const channel = useSelector(getCurrentChannel); + const channelMember = useSelector(getMyCurrentChannelMembership); if (!channel) { return null; @@ -67,6 +69,29 @@ const ChannelHeaderTitle = ({ channelTitle = ; } + // title without menu for channel preview + if (isEmptyObject(channelMember)) { + return ( +
+ + + {archivedIcon} + {channelTitle} + + + +
+ ); + } + if (isDirect && dmUser?.is_bot) { return (