Fixed create direct channel route to use a proper team id (#146)

This commit is contained in:
Harrison Healey 2016-12-20 13:54:23 -05:00 committed by enahum
parent 8e59ea606e
commit 0d5215a8b7
3 changed files with 5 additions and 5 deletions

View file

@ -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([

View file

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

View file

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