Fix JS errors when receiving message when on no teams (#6533)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
09e7ba23e3
Коммит
f662d0d632
@@ -36,7 +36,7 @@ import store from 'stores/redux_store.jsx';
|
|||||||
const dispatch = store.dispatch;
|
const dispatch = store.dispatch;
|
||||||
const getState = store.getState;
|
const getState = store.getState;
|
||||||
import {removeUserFromTeam} from 'mattermost-redux/actions/teams';
|
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) {
|
export function emitChannelClickEvent(channel) {
|
||||||
function userVisitedFakeChannel(chan, success, fail) {
|
function userVisitedFakeChannel(chan, success, fail) {
|
||||||
@@ -557,13 +557,13 @@ export function redirectUserToDefaultTeam() {
|
|||||||
redirect(teams[teamId].name, channel);
|
redirect(teams[teamId].name, channel);
|
||||||
} else if (channelId) {
|
} else if (channelId) {
|
||||||
Client.setTeamId(teamId);
|
Client.setTeamId(teamId);
|
||||||
Client.getChannel(
|
getChannelAndMyMember(channelId)(dispatch, getState).then(
|
||||||
channelId,
|
|
||||||
(data) => {
|
(data) => {
|
||||||
redirect(teams[teamId].name, data.channel.name);
|
if (data) {
|
||||||
},
|
redirect(teams[teamId].name, data.channel.name);
|
||||||
() => {
|
} else {
|
||||||
redirect(teams[teamId].name, 'town-square');
|
redirect(teams[teamId].name, 'town-square');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import {
|
|||||||
|
|
||||||
import {getClientConfig, getLicenseConfig} from 'mattermost-redux/actions/general';
|
import {getClientConfig, getLicenseConfig} from 'mattermost-redux/actions/general';
|
||||||
import {getTeamMembersByIds, getMyTeamMembers} from 'mattermost-redux/actions/teams';
|
import {getTeamMembersByIds, getMyTeamMembers} from 'mattermost-redux/actions/teams';
|
||||||
|
import {getChannelAndMyMember} from 'mattermost-redux/actions/channels';
|
||||||
|
|
||||||
export function loadMe(callback) {
|
export function loadMe(callback) {
|
||||||
loadMeRedux()(dispatch, getState).then(
|
loadMeRedux()(dispatch, getState).then(
|
||||||
@@ -276,21 +277,13 @@ export function loadNewDMIfNeeded(channelId) {
|
|||||||
if (channel) {
|
if (channel) {
|
||||||
checkPreference(channel);
|
checkPreference(channel);
|
||||||
} else {
|
} else {
|
||||||
Client.getChannel(
|
getChannelAndMyMember(channelId)(dispatch, getState).then(
|
||||||
channelId,
|
|
||||||
(data) => {
|
(data) => {
|
||||||
AppDispatcher.handleServerAction({
|
if (data) {
|
||||||
type: ActionTypes.RECEIVED_CHANNEL,
|
checkPreference(data.channel);
|
||||||
channel: data.channel,
|
}
|
||||||
member: data.member
|
|
||||||
});
|
|
||||||
|
|
||||||
checkPreference(data.channel);
|
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
AsyncClient.dispatchError(err, 'getChannel');
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,21 +301,11 @@ export function loadNewGMIfNeeded(channelId) {
|
|||||||
if (channel) {
|
if (channel) {
|
||||||
checkPreference();
|
checkPreference();
|
||||||
} else {
|
} else {
|
||||||
Client.getChannel(
|
getChannelAndMyMember(channelId)(dispatch, getState).then(
|
||||||
channelId,
|
() => {
|
||||||
(data) => {
|
|
||||||
AppDispatcher.handleServerAction({
|
|
||||||
type: ActionTypes.RECEIVED_CHANNEL,
|
|
||||||
channel: data.channel,
|
|
||||||
member: data.member
|
|
||||||
});
|
|
||||||
|
|
||||||
checkPreference();
|
checkPreference();
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
AsyncClient.dispatchError(err, 'getChannel');
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user