diff options
author | Antti Ahti <antti.ahti@gmail.com> | 2015-10-14 18:27:03 +0300 |
---|---|---|
committer | Antti Ahti <antti.ahti@gmail.com> | 2015-10-14 18:27:03 +0300 |
commit | 1ab7034574de2229d3cfc49391e6579db37a3064 (patch) | |
tree | 64212e4e35cc06c6a9d24c53dad5843efea6a846 /web/react/components | |
parent | 830e8b04d9cbc5652ab8b23d469e1c75ff5f8516 (diff) | |
download | chat-1ab7034574de2229d3cfc49391e6579db37a3064.tar.gz chat-1ab7034574de2229d3cfc49391e6579db37a3064.tar.bz2 chat-1ab7034574de2229d3cfc49391e6579db37a3064.zip |
Use team display name in team switcher menu
- /teams/find_teams returns team objects instead of just team names
- use display_name in UI instead of name in the team switch menu
Diffstat (limited to 'web/react/components')
-rw-r--r-- | web/react/components/navbar_dropdown.jsx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx index 49d517419..b3f8e4418 100644 --- a/web/react/components/navbar_dropdown.jsx +++ b/web/react/components/navbar_dropdown.jsx @@ -145,7 +145,7 @@ export default class NavbarDropdown extends React.Component { var teams = []; - if (this.state.teams.length > 1) { + if (Object.keys(this.state.teams).length > 1) { teams.push( <li className='divider' @@ -154,11 +154,14 @@ 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>); + for (let teamId in this.state.teams) { + if (this.state.teams.hasOwnProperty(teamId)) { + let team = this.state.teams[teamId]; + 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>); + } } - }); + } } if (global.window.config.EnableTeamCreation === 'true') { |