diff --git a/app/components/channel_link/channel_link.js b/app/components/channel_link/channel_link.js index 0c3ef67f1..de35dac4e 100644 --- a/app/components/channel_link/channel_link.js +++ b/app/components/channel_link/channel_link.js @@ -23,8 +23,10 @@ export default class ChannelLink extends React.PureComponent { textStyle: CustomPropTypes.Style, channelsByName: PropTypes.object.isRequired, actions: PropTypes.shape({ + dismissAllModals: PropTypes.func.isRequired, handleSelectChannel: PropTypes.func.isRequired, joinChannel: PropTypes.func.isRequired, + popToRoot: PropTypes.func.isRequired, }).isRequired, }; @@ -73,7 +75,10 @@ export default class ChannelLink extends React.PureComponent { } if (channel.id) { - this.props.actions.handleSelectChannel(channel.id); + const {dismissAllModals, handleSelectChannel, popToRoot} = this.props.actions; + handleSelectChannel(channel.id); + dismissAllModals(); + popToRoot(); if (this.props.onChannelLinkPress) { this.props.onChannelLinkPress(channel); diff --git a/app/components/channel_link/channel_link.test.js b/app/components/channel_link/channel_link.test.js index 611b1a120..a79abfad7 100644 --- a/app/components/channel_link/channel_link.test.js +++ b/app/components/channel_link/channel_link.test.js @@ -30,8 +30,10 @@ describe('ChannelLink', () => { textStyle: {color: '#3d3c40', fontSize: 15, lineHeight: 20}, channelsByName, actions: { + dismissAllModals: jest.fn(), handleSelectChannel: jest.fn(), joinChannel: jest.fn(), + popToRoot: jest.fn(), }, }; diff --git a/app/components/channel_link/index.js b/app/components/channel_link/index.js index 6b2ed9edd..174c2b93f 100644 --- a/app/components/channel_link/index.js +++ b/app/components/channel_link/index.js @@ -10,6 +10,7 @@ import {getChannelsNameMapInCurrentTeam} from 'mattermost-redux/selectors/entiti import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams'; import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; +import {dismissAllModals, popToRoot} from 'app/actions/navigation'; import {handleSelectChannel} from 'app/actions/views/channel'; import ChannelLink from './channel_link'; @@ -43,8 +44,10 @@ function makeMapStateToProps() { function mapDispatchToProps(dispatch) { return { actions: bindActionCreators({ + dismissAllModals, handleSelectChannel, joinChannel, + popToRoot, }, dispatch), }; }