summaryrefslogtreecommitdiffstats
path: root/web/react/components/navbar_dropdown.jsx
diff options
context:
space:
mode:
authorAsaad Mahmood <Unknowngi@live.com>2015-10-16 18:06:40 +0500
committerAsaad Mahmood <Unknowngi@live.com>2015-10-16 18:06:40 +0500
commit0fbe63eb37b0764a106b0fdd47bc149f122b520d (patch)
tree77cadc54d3a8d0e7812e69c50628cc7f3c5d71b7 /web/react/components/navbar_dropdown.jsx
parentb00ffa83e7371fa7dd4570130ee8b506943aee01 (diff)
parent89716cb046ee3c8f13b361053d91149f5ce29cbf (diff)
downloadchat-0fbe63eb37b0764a106b0fdd47bc149f122b520d.tar.gz
chat-0fbe63eb37b0764a106b0fdd47bc149f122b520d.tar.bz2
chat-0fbe63eb37b0764a106b0fdd47bc149f122b520d.zip
Merge branch 'master' of https://github.com/mattermost/platform into ui-improvements
Diffstat (limited to 'web/react/components/navbar_dropdown.jsx')
-rw-r--r--web/react/components/navbar_dropdown.jsx25
1 files changed, 21 insertions, 4 deletions
diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx
index e0410800f..1cb13bbe5 100644
--- a/web/react/components/navbar_dropdown.jsx
+++ b/web/react/components/navbar_dropdown.jsx
@@ -11,7 +11,24 @@ var AboutBuildModal = require('./about_build_modal.jsx');
var Constants = require('../utils/constants.jsx');
function getStateFromStores() {
- return {teams: UserStore.getTeams()};
+ let teams = [];
+ let teamsObject = UserStore.getTeams();
+ for (let teamId in teamsObject) {
+ if (teamsObject.hasOwnProperty(teamId)) {
+ teams.push(teamsObject[teamId]);
+ }
+ }
+ teams.sort(function sortByDisplayName(teamA, teamB) {
+ let teamADisplayName = teamA.display_name.toLowerCase();
+ let teamBDisplayName = teamB.display_name.toLowerCase();
+ if (teamADisplayName < teamBDisplayName) {
+ return -1;
+ } else if (teamADisplayName > teamBDisplayName) {
+ return 1;
+ }
+ return 0;
+ });
+ return {teams};
}
export default class NavbarDropdown extends React.Component {
@@ -154,9 +171,9 @@ export default class NavbarDropdown extends React.Component {
</li>
);
- this.state.teams.forEach((teamName) => {
- if (teamName !== this.props.teamName) {
- teams.push(<li key={teamName}><a href={Utils.getWindowLocationOrigin() + '/' + teamName}>{'Switch to ' + teamName}</a></li>);
+ this.state.teams.forEach((team) => {
+ if (team.name !== this.props.teamName) {
+ teams.push(<li key={team.name}><a href={Utils.getWindowLocationOrigin() + '/' + team.name}>{'Switch to ' + team.display_name}</a></li>);
}
});
}