Remove MakeDirectChannelVisible and add client handling for showing DMs (#5430)

Этот коммит содержится в:
Joram Wilander
2017-02-15 18:54:24 -05:00
коммит произвёл GitHub
родитель 745e2f4923
Коммит db2966b7cb
8 изменённых файлов: 61 добавлений и 104 удалений

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

@@ -13,6 +13,7 @@ import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
import Constants from 'utils/constants.jsx';
const ActionTypes = Constants.ActionTypes;
import * as AsyncClient from 'utils/async_client.jsx';
import * as Utils from 'utils/utils.jsx';
import Client from 'client/web_client.jsx';
import ChannelStore from 'stores/channel_store.jsx';
import BrowserStore from 'stores/browser_store.jsx';
@@ -20,7 +21,7 @@ import BrowserStore from 'stores/browser_store.jsx';
import emojiRoute from 'routes/route_emoji.jsx';
import integrationsRoute from 'routes/route_integrations.jsx';
import {loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_actions.jsx';
import {loadNewDMIfNeeded, loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_actions.jsx';
function onChannelEnter(nextState, replace, callback) {
doChannelChange(nextState, replace, callback);
@@ -33,6 +34,10 @@ function doChannelChange(state, replace, callback) {
} else {
channel = ChannelStore.getByName(state.params.channel);
if (channel.type === Constants.DM_CHANNEL) {
loadNewDMIfNeeded(Utils.getUserIdFromChannelName(channel));
}
if (!channel) {
Client.joinChannelByName(
state.params.channel,
@@ -100,7 +105,6 @@ function preNeedsTeam(nextState, replace, callback) {
if (nextState.location.pathname.indexOf('/channels/') > -1 ||
nextState.location.pathname.indexOf('/pl/') > -1) {
loadProfilesAndTeamMembersForDMSidebar();
AsyncClient.getMyTeamsUnread();
const teams = TeamStore.getAll();
for (const id in teams) {
@@ -120,6 +124,7 @@ function preNeedsTeam(nextState, replace, callback) {
});
loadStatusesForChannelAndSidebar();
loadProfilesAndTeamMembersForDMSidebar();
d1.resolve();
},