Unverified Commit 42ea16bd authored by Christopher Speller's avatar Christopher Speller Committed by GitHub
Browse files

Fixing opening a GM with the channel switcher. (#2047)

parent 4453f86f
......@@ -4,7 +4,7 @@
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {switchToChannel} from 'actions/views/channel';
import {switchToChannelById} from 'actions/views/channel';
import QuickSwitchModal from './quick_switch_modal.jsx';
......@@ -17,7 +17,7 @@ function mapStateToProps() {
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
switchToChannel,
switchToChannelById,
}, dispatch),
};
}
......
......@@ -43,7 +43,7 @@ export default class QuickSwitchModal extends React.PureComponent {
showTeamSwitcher: PropTypes.bool,
actions: PropTypes.shape({
switchToChannel: PropTypes.func.isRequired,
switchToChannelById: PropTypes.func.isRequired,
}).isRequired,
}
......@@ -131,7 +131,7 @@ export default class QuickSwitchModal extends React.PureComponent {
if (this.state.mode === CHANNEL_MODE) {
const selectedChannel = selected.channel;
this.props.actions.switchToChannel(selectedChannel).then((result) => {
this.props.actions.switchToChannelById(selectedChannel.id).then((result) => {
if (result.data) {
this.onHide();
}
......
......@@ -15,7 +15,7 @@ describe('components/QuickSwitchModal', () => {
onHide: jest.fn(),
showTeamSwitcher: false,
actions: {
switchToChannel: jest.fn().mockImplementation(() => {
switchToChannelById: jest.fn().mockImplementation(() => {
const error = {
message: 'Failed',
};
......@@ -42,7 +42,7 @@ describe('components/QuickSwitchModal', () => {
wrapper.instance().handleSubmit();
expect(baseProps.onHide).not.toBeCalled();
expect(props.actions.switchToChannel).not.toBeCalled();
expect(props.actions.switchToChannelById).not.toBeCalled();
});
it('should fail to switch to a channel', (done) => {
......@@ -52,7 +52,7 @@ describe('components/QuickSwitchModal', () => {
const channel = {id: 'channel_id', userId: 'user_id', type: Constants.DM_CHANNEL};
wrapper.instance().handleSubmit({channel});
expect(baseProps.actions.switchToChannel).toBeCalledWith(channel);
expect(baseProps.actions.switchToChannelById).toBeCalledWith(channel.id);
process.nextTick(() => {
expect(baseProps.onHide).not.toBeCalled();
done();
......@@ -63,7 +63,7 @@ describe('components/QuickSwitchModal', () => {
const props = {
...baseProps,
actions: {
switchToChannel: jest.fn().mockImplementation(() => {
switchToChannelById: jest.fn().mockImplementation(() => {
const data = true;
return Promise.resolve({data});
}),
......@@ -76,7 +76,7 @@ describe('components/QuickSwitchModal', () => {
const channel = {id: 'channel_id', userId: 'user_id', type: Constants.DM_CHANNEL};
wrapper.instance().handleSubmit({channel});
expect(props.actions.switchToChannel).toBeCalledWith(channel);
expect(props.actions.switchToChannelById).toBeCalledWith(channel.id);
process.nextTick(() => {
expect(baseProps.onHide).toBeCalled();
done();
......
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