From ca9f348be6bf62fc888df9a710c9af155872528e Mon Sep 17 00:00:00 2001 From: David Lu Date: Fri, 27 May 2016 11:52:19 -0700 Subject: Changed channel navigation (#3142) --- webapp/components/navbar.jsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx index d4968986e..93f800814 100644 --- a/webapp/components/navbar.jsx +++ b/webapp/components/navbar.jsx @@ -35,7 +35,7 @@ import {Link, browserHistory} from 'react-router'; import React from 'react'; -import * as GlobalActions from 'actions/global_actions.jsx'; +import * as ChannelActions from 'actions/channel_actions.jsx'; export default class Navbar extends React.Component { constructor(props) { @@ -56,7 +56,6 @@ export default class Navbar extends React.Component { this.navigateChannelShortcut = this.navigateChannelShortcut.bind(this); this.navigateUnreadChannelShortcut = this.navigateUnreadChannelShortcut.bind(this); this.getDisplayedChannels = this.getDisplayedChannels.bind(this); - this.compareByName = this.compareByName.bind(this); this.compareByDisplayName = this.compareByDisplayName.bind(this); const state = this.getStateFromStores(); @@ -182,7 +181,7 @@ export default class Navbar extends React.Component { nextIndex = curIndex - 1; } nextChannel = allChannels[Utils.mod(nextIndex, allChannels.length)]; - GlobalActions.emitChannelClickEvent(nextChannel); + ChannelActions.goToChannel(nextChannel); } } navigateUnreadChannelShortcut(e) { @@ -214,12 +213,12 @@ export default class Navbar extends React.Component { } if (unreadCounts.msgs !== 0 || unreadCounts.mentions !== 0) { nextChannel = allChannels[nextIndex]; - GlobalActions.emitChannelClickEvent(nextChannel); + ChannelActions.goToChannel(nextChannel); } } } getDisplayedChannels() { - const allChannels = ChannelStore.getChannels().sort(this.compareByName); + const allChannels = ChannelStore.getChannels().sort(this.compareByDisplayName); const publicChannels = allChannels.filter((channel) => channel.type === Constants.OPEN_CHANNEL); const privateChannels = allChannels.filter((channel) => channel.type === Constants.PRIVATE_CHANNEL); @@ -247,11 +246,8 @@ export default class Navbar extends React.Component { return publicChannels.concat(privateChannels).concat(directChannels).concat(directNonTeamChannels); } - compareByName(a, b) { - return a.name.localeCompare(b.name); - } - compareByDisplayName(a, b) { - return a.display_name.localeCompare(b.display_name); + compareByDisplayName(channelA, channelB) { + return channelA.display_name.localeCompare(channelB.display_name); } createDropdown(channel, channelTitle, isAdmin, isDirect, popoverContent) { if (channel) { -- cgit v1.2.3-1-g7c22