Skip to content

Commit

Permalink
MM-58452-Update system console with shared indicator (mattermost#28131)
Browse files Browse the repository at this point in the history
* update system console with shared indicator

* lint fixes, test fixes, i18 fixes

* minor tweeks

* Update webapp/channels/src/components/channel_members_rhs/member.tsx

Co-authored-by: Caleb Roseland <[email protected]>

---------

Co-authored-by: Caleb Roseland <[email protected]>
  • Loading branch information
sbishel and calebroseland authored Sep 11, 2024
1 parent 1d6eb20 commit 5d8bf5f
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ function SystemUsers(props: Props) {

function handleRowClick(userId: UserReport['id']) {
if (userId.length !== 0) {
history.push(`/admin_console/user_management/user/${userId}`);
const remoteID = userReports.find((userReport) => userReport.id === userId)?.remote_id;
if (!remoteID) {
history.push(`/admin_console/user_management/user/${userId}`);
}
}
}

Expand Down Expand Up @@ -403,16 +406,21 @@ function SystemUsers(props: Props) {
id: 'admin.system_users.list.actions',
defaultMessage: 'Actions',
}),
cell: (info: CellContext<UserReport, null>) => (
<SystemUsersListAction
rowIndex={info.cell.row.index}
tableId={tableId}
user={info.row.original}
currentUser={props.currentUser}
updateUser={(updatedUser) => updateUserReport(info.row.original.id, updatedUser)}
onError={(error) => updateUserReport(info.row.original.id, {error})}
/>
),
cell: (info: CellContext<UserReport, null>) => {
if (info.row.original?.remote_id?.length) {
return (<></>);
}
return (
<SystemUsersListAction
rowIndex={info.cell.row.index}
tableId={tableId}
user={info.row.original}
currentUser={props.currentUser}
updateUser={(updatedUser) => updateUserReport(info.row.original.id, updatedUser)}
onError={(error) => updateUserReport(info.row.original.id, {error})}
/>
);
},
enableHiding: false,
enablePinning: true,
enableSorting: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,15 +979,19 @@ exports[`admin_console/team_channel_settings/channel/ChannelList should match sn
className="group-name overflow--ellipsis row-content"
data-testid="channel-display-name"
>
<SharedChannelIndicator
channelType="O"
<GlobeIcon
className="channel-icon"
/>
<span
className="TeamList_channelDisplayName"
>
DN
</span>
<SharedChannelIndicator
channelType="O"
className="channel-icon"
withTooltip={true}
/>
</span>,
"team": <span
className="group-description row-content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,13 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
);
}

if (channel.shared) {
iconToDisplay = (
<SharedChannelIndicator
className='channel-icon'
channelType={channel.type}
/>
);
}
const sharedChannelIcon = channel.shared ? (
<SharedChannelIndicator
className='channel-icon'
channelType={channel.type}
withTooltip={true}
/>
) : null;

return {
cells: {
Expand All @@ -224,6 +223,7 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
<span className='TeamList_channelDisplayName'>
{channel.display_name}
</span>
{sharedChannelIcon}
</span>
),
team: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,7 @@ exports[`components/channel_members_dropdown should match snapshot for dropdown
</MenuWrapper>
`;

exports[`components/channel_members_dropdown should match snapshot for dropdown with shared user 1`] = `
<div
className="more-modal__shared-actions"
>
<WithTooltip
id="sharedTooltip"
placement="bottom"
title={
<Memo(MemoizedFormattedMessage)
defaultMessage="From trusted organizations"
id="shared_user_indicator.tooltip"
/>
}
>
<span>
<MemoizedFormattedMessage
defaultMessage="Shared Member"
id="channel_members_dropdown.shared_member"
/>
<i
className="shared-user-icon icon-circle-multiple-outline"
/>
</span>
</WithTooltip>
</div>
`;
exports[`components/channel_members_dropdown should match snapshot for dropdown with shared user 1`] = `<Fragment />`;

exports[`components/channel_members_dropdown should match snapshot for group_constrained channel 1`] = `
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import LeaveChannelModal from 'components/leave_channel_modal';
import DropdownIcon from 'components/widgets/icons/fa_dropdown_icon';
import Menu from 'components/widgets/menu/menu';
import MenuWrapper from 'components/widgets/menu/menu_wrapper';
import WithTooltip from 'components/with_tooltip';

import {Constants, ModalIdentifiers} from 'utils/constants';
import * as Utils from 'utils/utils';
Expand Down Expand Up @@ -154,28 +153,7 @@ export default function ChannelMembersDropdown({
const currentRole = renderRole(isChannelAdmin, isGuest);

if (user.remote_id) {
return (
<div className='more-modal__shared-actions'>
<WithTooltip
id='sharedTooltip'
placement='bottom'
title={
<FormattedMessage
id='shared_user_indicator.tooltip'
defaultMessage='From trusted organizations'
/>
}
>
<span>
<FormattedMessage
id='channel_members_dropdown.shared_member'
defaultMessage='Shared Member'
/>
<i className='shared-user-icon icon-circle-multiple-outline'/>
</span>
</WithTooltip>
</div>
);
return (<></>);
}

const canMakeUserChannelMember = canChangeMemberRoles && isChannelAdmin;
Expand Down
16 changes: 16 additions & 0 deletions webapp/channels/src/components/channel_members_rhs/member.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ChannelMembersDropdown from 'components/channel_members_dropdown';
import CustomStatusEmoji from 'components/custom_status/custom_status_emoji';
import ProfilePicture from 'components/profile_picture';
import ProfilePopover from 'components/profile_popover';
import SharedChannelIndicator from 'components/shared_channel_indicator';
import GuestTag from 'components/widgets/tag/guest_tag';
import WithTooltip from 'components/with_tooltip';

Expand Down Expand Up @@ -85,6 +86,12 @@ const RoleChooser = styled.div`
}
`;

const SharedIcon = styled.span`
margin: 0 0 0 4px;
font-size: 16px;
line-height: 20px;
`;

interface Props {
className?: string;
channel: Channel;
Expand Down Expand Up @@ -128,6 +135,15 @@ const Member = ({className, channel, member, index, totalUsers, editing, actions
<DisplayName>
{member.displayName}
{isGuest(member.user.roles) && <GuestTag/>}
{member.user.remote_id &&
(
<SharedIcon>
<SharedChannelIndicator
channelType={'O'}
withTooltip={true}
/>
</SharedIcon>
)}
</DisplayName>
{
member.displayName === member.user.username ? null : <Username>{'@'}{member.user.username}</Username>
Expand Down
1 change: 0 additions & 1 deletion webapp/channels/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3154,7 +3154,6 @@
"channel_members_dropdown.make_channel_members": "Make Channel Members",
"channel_members_dropdown.menuAriaLabel": "Change the role of channel member",
"channel_members_dropdown.remove_from_channel": "Remove from Channel",
"channel_members_dropdown.shared_member": "Shared Member",
"channel_members_modal.addNew": " Add Members",
"channel_members_modal.members": " Members",
"channel_members_rhs.action_bar.add_button": "Add",
Expand Down

0 comments on commit 5d8bf5f

Please sign in to comment.