Go to channel screen when tapping on a channel link (#3265)

This commit is contained in:
Elias Nahum 2019-09-17 12:30:06 -03:00 committed by Miguel Alatzar
parent 0811fd7149
commit e9db272a9e
3 changed files with 11 additions and 1 deletions

View file

@ -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);

View file

@ -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(),
},
};

View file

@ -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),
};
}