Commit ce5e6646 authored by Martin Kraft's avatar Martin Kraft Committed by Harrison Healey

MM-13612: Always shows 'view members' for default channel. (#2242)

* MM-13612: Always shows 'view members' for default channel.

* Update components/channel_header_dropdown/menu_items/view_and_manage_members.js
Co-Authored-By: 's avatarmkraft <martin@upspin.org>
parent 52ed6cd7
......@@ -65,20 +65,11 @@ exports[`components/ChannelHeaderDropdown/MenuItem.ViewAndManageMembers should m
modalId="channel_members"
role="menuitem"
>
<Connect(ChannelPermissionGate)
invert={false}
permissions={
Array [
"manage_public_channel_members",
]
}
>
<FormattedMessage
defaultMessage="View Members"
id="channel_header.viewMembers"
values={Object {}}
/>
</Connect(ChannelPermissionGate)>
<FormattedMessage
defaultMessage="View Members"
id="channel_header.viewMembers"
values={Object {}}
/>
</Connect(ModalToggleButtonRedux)>
</li>
`;
......@@ -23,6 +23,12 @@ const ViewAndManageMembers = ({channel, isDefault}) => {
const isPrivate = channel.type === Constants.PRIVATE_CHANNEL;
const permission = isPrivate ? Permissions.MANAGE_PRIVATE_CHANNEL_MEMBERS : Permissions.MANAGE_PUBLIC_CHANNEL_MEMBERS;
const viewMembersMessage = (
<FormattedMessage
id='channel_header.viewMembers'
defaultMessage='View Members'
/>
);
return (
<li role='presentation'>
......@@ -34,28 +40,27 @@ const ViewAndManageMembers = ({channel, isDefault}) => {
dialogProps={{channel}}
>
{!isDefault &&
<ChannelPermissionGate
channelId={channel.id}
teamId={channel.team_id}
permissions={[permission]}
>
<FormattedMessage
id='channel_header.manageMembers'
defaultMessage='Manage Members'
/>
</ChannelPermissionGate>
}
<ChannelPermissionGate
channelId={channel.id}
teamId={channel.team_id}
permissions={[permission]}
invert={!isDefault}
>
<FormattedMessage
id='channel_header.viewMembers'
defaultMessage='View Members'
/>
</ChannelPermissionGate>
<>
<ChannelPermissionGate
channelId={channel.id}
teamId={channel.team_id}
permissions={[permission]}
>
<FormattedMessage
id='channel_header.manageMembers'
defaultMessage='Manage Members'
/>
</ChannelPermissionGate>
<ChannelPermissionGate
channelId={channel.id}
teamId={channel.team_id}
permissions={[permission]}
invert={true}
>
{viewMembersMessage}
</ChannelPermissionGate>
</>}
{isDefault && viewMembersMessage}
</ToggleModalButtonRedux>
</li>
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment