PLT-4167 Team Sidebar (#4569)
* PLT-4167 Team Sidebar * Address feedback from PM * change route from my_members to members * bug fixes * Updating styles for teams sidebar (#4681) * Added PM changes * Fix corner cases * Addressing feedback * use two different endpoints * Bug fixes * Rename model and client functions, using preferences to store last team and channel viewed * Fix mobile notification count and closing the team sidebar * unit test, fixed bad merge and retrieve from cached when available * bug fixes * use id for last channel in preferences, query optimization * Updating multi team css (#4830)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
3ce2ce9dc8
Коммит
999d1553e1
@@ -14,6 +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 emojiRoute from 'routes/route_emoji.jsx';
|
||||
import integrationsRoute from 'routes/route_integrations.jsx';
|
||||
@@ -63,7 +64,7 @@ function preNeedsTeam(nextState, replace, callback) {
|
||||
// First check to make sure you're in the current team
|
||||
// for the current url.
|
||||
const teamName = nextState.params.team;
|
||||
var team = TeamStore.getByName(teamName);
|
||||
const team = TeamStore.getByName(teamName);
|
||||
|
||||
if (!team) {
|
||||
browserHistory.push('/');
|
||||
@@ -75,9 +76,10 @@ function preNeedsTeam(nextState, replace, callback) {
|
||||
TeamStore.saveMyTeam(team);
|
||||
TeamStore.emitChange();
|
||||
loadProfilesAndTeamMembersForDMSidebar();
|
||||
AsyncClient.getMyTeamsUnread();
|
||||
AsyncClient.getMyChannelMembers();
|
||||
|
||||
var d1 = $.Deferred(); //eslint-disable-line new-cap
|
||||
const d1 = $.Deferred(); //eslint-disable-line new-cap
|
||||
|
||||
Client.getChannels(
|
||||
(data) => {
|
||||
@@ -101,6 +103,20 @@ function preNeedsTeam(nextState, replace, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function selectLastChannel(nextState, replace, callback) {
|
||||
const team = TeamStore.getByName(nextState.params.team);
|
||||
const channelId = PreferenceStore.get(team.id, 'channel');
|
||||
const channel = ChannelStore.getChannelById(channelId);
|
||||
|
||||
let channelName = 'town-square';
|
||||
if (channel) {
|
||||
channelName = channel.name;
|
||||
}
|
||||
|
||||
replace(`/${team.name}/channels/${channelName}`);
|
||||
callback();
|
||||
}
|
||||
|
||||
function onPermalinkEnter(nextState, replace, callback) {
|
||||
const postId = nextState.params.postid;
|
||||
GlobalActions.emitPostFocusEvent(
|
||||
@@ -112,7 +128,7 @@ function onPermalinkEnter(nextState, replace, callback) {
|
||||
export default {
|
||||
path: ':team',
|
||||
onEnter: preNeedsTeam,
|
||||
indexRoute: {onEnter: (nextState, replace) => replace('/' + nextState.params.team + '/channels/town-square')},
|
||||
indexRoute: {onEnter: selectLastChannel},
|
||||
childRoutes: [
|
||||
integrationsRoute,
|
||||
emojiRoute,
|
||||
@@ -126,10 +142,11 @@ export default {
|
||||
onEnter: onChannelEnter,
|
||||
getComponents: (location, callback) => {
|
||||
Promise.all([
|
||||
System.import('components/team_sidebar/team_sidebar_controller.jsx'),
|
||||
System.import('components/sidebar.jsx'),
|
||||
System.import('components/channel_view.jsx')
|
||||
]).then(
|
||||
(comarr) => callback(null, {sidebar: comarr[0].default, center: comarr[1].default})
|
||||
(comarr) => callback(null, {team_sidebar: comarr[0].default, sidebar: comarr[1].default, center: comarr[2].default})
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -138,10 +155,11 @@ export default {
|
||||
onEnter: onPermalinkEnter,
|
||||
getComponents: (location, callback) => {
|
||||
Promise.all([
|
||||
System.import('components/team_sidebar/team_sidebar_controller.jsx'),
|
||||
System.import('components/sidebar.jsx'),
|
||||
System.import('components/permalink_view.jsx')
|
||||
]).then(
|
||||
(comarr) => callback(null, {sidebar: comarr[0].default, center: comarr[1].default})
|
||||
(comarr) => callback(null, {team_sidebar: comarr[0].default, sidebar: comarr[1].default, center: comarr[2].default})
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -149,10 +167,11 @@ export default {
|
||||
path: 'tutorial',
|
||||
getComponents: (location, callback) => {
|
||||
Promise.all([
|
||||
System.import('components/team_sidebar/team_sidebar_controller.jsx'),
|
||||
System.import('components/sidebar.jsx'),
|
||||
System.import('components/tutorial/tutorial_view.jsx')
|
||||
]).then(
|
||||
(comarr) => callback(null, {sidebar: comarr[0].default, center: comarr[1].default})
|
||||
(comarr) => callback(null, {team_sidebar: comarr[0].default, sidebar: comarr[1].default, center: comarr[2].default})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user