mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fix JS errors when receiving message when on no teams (#6533)
This commit is contained in:
@@ -36,7 +36,7 @@ import store from 'stores/redux_store.jsx';
|
||||
const dispatch = store.dispatch;
|
||||
const getState = store.getState;
|
||||
import {removeUserFromTeam} from 'mattermost-redux/actions/teams';
|
||||
import {viewChannel, getChannelStats, getMyChannelMember} from 'mattermost-redux/actions/channels';
|
||||
import {viewChannel, getChannelStats, getMyChannelMember, getChannelAndMyMember} from 'mattermost-redux/actions/channels';
|
||||
|
||||
export function emitChannelClickEvent(channel) {
|
||||
function userVisitedFakeChannel(chan, success, fail) {
|
||||
@@ -557,13 +557,13 @@ export function redirectUserToDefaultTeam() {
|
||||
redirect(teams[teamId].name, channel);
|
||||
} else if (channelId) {
|
||||
Client.setTeamId(teamId);
|
||||
Client.getChannel(
|
||||
channelId,
|
||||
getChannelAndMyMember(channelId)(dispatch, getState).then(
|
||||
(data) => {
|
||||
redirect(teams[teamId].name, data.channel.name);
|
||||
},
|
||||
() => {
|
||||
redirect(teams[teamId].name, 'town-square');
|
||||
if (data) {
|
||||
redirect(teams[teamId].name, data.channel.name);
|
||||
} else {
|
||||
redirect(teams[teamId].name, 'town-square');
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -48,6 +48,7 @@ import {
|
||||
|
||||
import {getClientConfig, getLicenseConfig} from 'mattermost-redux/actions/general';
|
||||
import {getTeamMembersByIds, getMyTeamMembers} from 'mattermost-redux/actions/teams';
|
||||
import {getChannelAndMyMember} from 'mattermost-redux/actions/channels';
|
||||
|
||||
export function loadMe(callback) {
|
||||
loadMeRedux()(dispatch, getState).then(
|
||||
@@ -276,21 +277,13 @@ export function loadNewDMIfNeeded(channelId) {
|
||||
if (channel) {
|
||||
checkPreference(channel);
|
||||
} else {
|
||||
Client.getChannel(
|
||||
channelId,
|
||||
getChannelAndMyMember(channelId)(dispatch, getState).then(
|
||||
(data) => {
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_CHANNEL,
|
||||
channel: data.channel,
|
||||
member: data.member
|
||||
});
|
||||
|
||||
checkPreference(data.channel);
|
||||
},
|
||||
(err) => {
|
||||
AsyncClient.dispatchError(err, 'getChannel');
|
||||
if (data) {
|
||||
checkPreference(data.channel);
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,21 +301,11 @@ export function loadNewGMIfNeeded(channelId) {
|
||||
if (channel) {
|
||||
checkPreference();
|
||||
} else {
|
||||
Client.getChannel(
|
||||
channelId,
|
||||
(data) => {
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_CHANNEL,
|
||||
channel: data.channel,
|
||||
member: data.member
|
||||
});
|
||||
|
||||
getChannelAndMyMember(channelId)(dispatch, getState).then(
|
||||
() => {
|
||||
checkPreference();
|
||||
},
|
||||
(err) => {
|
||||
AsyncClient.dispatchError(err, 'getChannel');
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user