summaryrefslogtreecommitdiffstats
path: root/webapp/routes
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-12-22 15:20:36 -0300
committerCorey Hulen <corey@hulen.com>2016-12-22 10:20:36 -0800
commitb79b2b2a53935cd883312c1158918291a926bacd (patch)
treefeb178ef53b3f8edf47824556bd4ba57ded8ce8d /webapp/routes
parentc9eb23a3d44c96042522bf7cdefc65903eb1d0a3 (diff)
downloadchat-b79b2b2a53935cd883312c1158918291a926bacd.tar.gz
chat-b79b2b2a53935cd883312c1158918291a926bacd.tar.bz2
chat-b79b2b2a53935cd883312c1158918291a926bacd.zip
Fix team switch (#4851)
* Fix team switch * Fix channel switching by using BrowserStore * Fixes plt-5076 and plt-5068 * Updating styles for Teams sidebar (#4875)
Diffstat (limited to 'webapp/routes')
-rw-r--r--webapp/routes/route_team.jsx55
1 files changed, 28 insertions, 27 deletions
diff --git a/webapp/routes/route_team.jsx b/webapp/routes/route_team.jsx
index a71ed3149..8416b91c0 100644
--- a/webapp/routes/route_team.jsx
+++ b/webapp/routes/route_team.jsx
@@ -14,7 +14,7 @@ const ActionTypes = Constants.ActionTypes;
import * as AsyncClient from 'utils/async_client.jsx';
import Client from 'client/web_client.jsx';
import ChannelStore from 'stores/channel_store.jsx';
-import PreferenceStore from 'stores/preference_store.jsx';
+import BrowserStore from 'stores/browser_store.jsx';
import emojiRoute from 'routes/route_emoji.jsx';
import integrationsRoute from 'routes/route_integrations.jsx';
@@ -70,45 +70,46 @@ function preNeedsTeam(nextState, replace, callback) {
browserHistory.push('/');
return;
}
- if (nextState.location.pathname.indexOf('/channels/') > -1) {
- GlobalActions.emitCloseRightHandSide();
- TeamStore.saveMyTeam(team);
- TeamStore.emitChange();
+ TeamStore.saveMyTeam(team);
+ BrowserStore.setGlobalItem('team', team.id);
+ TeamStore.emitChange();
+ GlobalActions.emitCloseRightHandSide();
+
+ if (nextState.location.pathname.indexOf('/channels/') > -1 ||
+ nextState.location.pathname.indexOf('/pl/') > -1) {
loadProfilesAndTeamMembersForDMSidebar();
AsyncClient.getMyTeamsUnread();
AsyncClient.getMyChannelMembers();
+ }
- const d1 = $.Deferred(); //eslint-disable-line new-cap
+ const d1 = $.Deferred(); //eslint-disable-line new-cap
- Client.getChannels(
- (data) => {
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_CHANNELS,
- channels: data
- });
+ Client.getChannels(
+ (data) => {
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_CHANNELS,
+ channels: data
+ });
- loadStatusesForChannelAndSidebar();
+ loadStatusesForChannelAndSidebar();
- d1.resolve();
- },
- (err) => {
- AsyncClient.dispatchError(err, 'getChannels');
- d1.resolve();
- }
- );
-
- $.when(d1).done(() => {
- callback();
- });
- } else {
+ d1.resolve();
+ },
+ (err) => {
+ AsyncClient.dispatchError(err, 'getChannels');
+ d1.resolve();
+ }
+ );
+
+ $.when(d1).done(() => {
callback();
- }
+ });
}
function selectLastChannel(nextState, replace, callback) {
const team = TeamStore.getByName(nextState.params.team);
- const channelId = PreferenceStore.get(team.id, 'channel');
+ const channelId = BrowserStore.getGlobalItem(team.id);
const channel = ChannelStore.getChannelById(channelId);
let channelName = 'town-square';