RN-152 Updated createGroupChannel's return value to match createDirectChannel (#7027)

* RN-152 Updated createGroupChannel's return value to match createDirectChannel

* Fixed handling of results from createDirectChannel

* Updated yarn.lock
Этот коммит содержится в:
Harrison Healey
2017-07-27 17:16:48 -04:00
коммит произвёл GitHub
родитель e83ba9a4a7
Коммит 67e2715274
3 изменённых файлов: 11 добавлений и 10 удалений

Просмотреть файл

@@ -181,14 +181,13 @@ export function openDirectChannelToUser(userId, success, error) {
export function openGroupChannelToUsers(userIds, success, error) {
ChannelActions.createGroupChannel(userIds)(dispatch, getState).then(
(data) => {
(result) => {
loadProfilesForSidebar();
if (data && success) {
success(data, false);
} else if (data == null && error) {
if (result.data && success) {
success(result.data, false);
} else if (result.error && error) {
browserHistory.push(TeamStore.getCurrentTeamUrl());
const serverError = getState().requests.channels.createChannel.error;
error({id: serverError.server_error_id, ...serverError});
error({id: result.error.server_error_id, ...result.error});
}
}
);

Просмотреть файл

@@ -45,9 +45,11 @@ export function emitChannelClickEvent(channel) {
const currentUserId = UserStore.getCurrentId();
const otherUserId = Utils.getUserIdFromChannelName(chan);
createDirectChannel(currentUserId, otherUserId)(dispatch, getState).then(
(data) => {
if (data) {
success(data);
(result) => {
const receivedChannel = result.data;
if (receivedChannel) {
success(receivedChannel);
} else {
fail();
}