diff --git a/service/actions/channels.js b/service/actions/channels.js index ba630a85d..77777e35b 100644 --- a/service/actions/channels.js +++ b/service/actions/channels.js @@ -71,13 +71,13 @@ export function createChannel(channel, userId) { }; } -export function createDirectChannel(userId, otherUserId) { +export function createDirectChannel(teamId, userId, otherUserId) { return async (dispatch, getState) => { dispatch({type: ChannelTypes.CREATE_CHANNEL_REQUEST}, getState); let created; try { - created = await Client.createDirectChannel(otherUserId); + created = await Client.createDirectChannel(teamId, otherUserId); } catch (error) { forceLogoutIfNecessary(error, dispatch); dispatch(batchActions([ diff --git a/service/client/client.js b/service/client/client.js index f4260502e..dac34aa67 100644 --- a/service/client/client.js +++ b/service/client/client.js @@ -419,9 +419,9 @@ export default class Client { ); }; - createDirectChannel = async (userId) => { + createDirectChannel = async (teamId, userId) => { return this.doFetch( - `${this.getChannelsRoute('fake')}/create_direct`, + `${this.getChannelsRoute(teamId)}/create_direct`, {method: 'post', body: JSON.stringify({user_id: userId})} ); }; diff --git a/test/service/actions/channels.test.js b/test/service/actions/channels.test.js index 354dcceff..4fe1512d2 100644 --- a/test/service/actions/channels.test.js +++ b/test/service/actions/channels.test.js @@ -94,7 +94,7 @@ describe('Actions.Channels', () => { }); await getProfiles(0)(store.dispatch, store.getState); - Actions.createDirectChannel(TestHelper.basicUser.id, user.id)(store.dispatch, store.getState); + Actions.createDirectChannel(TestHelper.basicTeam.id, TestHelper.basicUser.id, user.id)(store.dispatch, store.getState); }); }).timeout(3000);