Commit 5077e2aa authored by George Goldberg's avatar George Goldberg

MM-13343: Include Add Members in GM header menu. (#2168)

parent eeff695d
...@@ -37,3 +37,27 @@ exports[`components/ChannelHeaderDropdown/MenuItem.AddMembers should match snaps ...@@ -37,3 +37,27 @@ exports[`components/ChannelHeaderDropdown/MenuItem.AddMembers should match snaps
</li> </li>
</Connect(ChannelPermissionGate)> </Connect(ChannelPermissionGate)>
`; `;
exports[`components/ChannelHeaderDropdown/MenuItem.AddMembers should render correctly if the channel type is DM 1`] = `
<li
role="presentation"
>
<Connect(ModalToggleButtonRedux)
dialogProps={
Object {
"isExistingChannel": true,
}
}
dialogType={[Function]}
id="channelAddMembersGroup"
modalId="create_dm_channel"
role="menuitem"
>
<FormattedMessage
defaultMessage="Add Members"
id="channel_header.addMembers"
values={Object {}}
/>
</Connect(ModalToggleButtonRedux)>
</li>
`;
...@@ -9,6 +9,7 @@ import {Permissions} from 'mattermost-redux/constants'; ...@@ -9,6 +9,7 @@ import {Permissions} from 'mattermost-redux/constants';
import ChannelPermissionGate from 'components/permissions_gates/channel_permission_gate'; import ChannelPermissionGate from 'components/permissions_gates/channel_permission_gate';
import ToggleModalButtonRedux from 'components/toggle_modal_button_redux'; import ToggleModalButtonRedux from 'components/toggle_modal_button_redux';
import ChannelInviteModal from 'components/channel_invite_modal'; import ChannelInviteModal from 'components/channel_invite_modal';
import MoreDirectChannels from 'components/more_direct_channels';
import {Constants, ModalIdentifiers} from 'utils/constants'; import {Constants, ModalIdentifiers} from 'utils/constants';
const AddMembers = ({channel, isDefault, isArchived}) => { const AddMembers = ({channel, isDefault, isArchived}) => {
...@@ -25,7 +26,22 @@ const AddMembers = ({channel, isDefault, isArchived}) => { ...@@ -25,7 +26,22 @@ const AddMembers = ({channel, isDefault, isArchived}) => {
} }
if (channel.type === Constants.GM_CHANNEL) { if (channel.type === Constants.GM_CHANNEL) {
return null; return (
<li role='presentation'>
<ToggleModalButtonRedux
id='channelAddMembersGroup'
role='menuitem'
modalId={ModalIdentifiers.CREATE_DM_CHANNEL}
dialogType={MoreDirectChannels}
dialogProps={{isExistingChannel: true}}
>
<FormattedMessage
id='channel_header.addMembers'
defaultMessage='Add Members'
/>
</ToggleModalButtonRedux>
</li>
);
} }
const isPrivate = channel.type === Constants.PRIVATE_CHANNEL; const isPrivate = channel.type === Constants.PRIVATE_CHANNEL;
......
...@@ -42,7 +42,7 @@ describe('components/ChannelHeaderDropdown/MenuItem.AddMembers', () => { ...@@ -42,7 +42,7 @@ describe('components/ChannelHeaderDropdown/MenuItem.AddMembers', () => {
expect(wrapper.isEmptyRender()).toBeTruthy(); expect(wrapper.isEmptyRender()).toBeTruthy();
}); });
it('should be hidden if the channel type is DM or GM', () => { it('should be hidden if the channel type is DM', () => {
const props = { const props = {
...baseProps, ...baseProps,
channel: {...baseProps.channel}, channel: {...baseProps.channel},
...@@ -51,8 +51,18 @@ describe('components/ChannelHeaderDropdown/MenuItem.AddMembers', () => { ...@@ -51,8 +51,18 @@ describe('components/ChannelHeaderDropdown/MenuItem.AddMembers', () => {
props.channel.type = Constants.DM_CHANNEL; props.channel.type = Constants.DM_CHANNEL;
expect(makeWrapper().isEmptyRender()).toBeTruthy(); expect(makeWrapper().isEmptyRender()).toBeTruthy();
});
props.channel.type = Constants.GM_CHANNEL; it('should render correctly if the channel type is DM', () => {
expect(makeWrapper().isEmptyRender()).toBeTruthy(); const props = {
...baseProps,
channel: {
...baseProps.channel,
type: Constants.GM_CHANNEL,
},
};
const wrapper = shallow(<AddMembers {...props}/>);
expect(wrapper).toMatchSnapshot();
}); });
}); });
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