Changed channel navigation (#3142)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
6f8d4a18ee
Коммит
ca9f348be6
10
webapp/actions/channel_actions.jsx
Обычный файл
10
webapp/actions/channel_actions.jsx
Обычный файл
@@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||||
|
// See License.txt for license information.
|
||||||
|
|
||||||
|
import {browserHistory} from 'react-router';
|
||||||
|
|
||||||
|
import TeamStore from 'stores/team_store.jsx';
|
||||||
|
|
||||||
|
export function goToChannel(channel) {
|
||||||
|
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + channel.name);
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@ import {Link, browserHistory} from 'react-router';
|
|||||||
|
|
||||||
import React from 'react';
|
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 {
|
export default class Navbar extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -56,7 +56,6 @@ export default class Navbar extends React.Component {
|
|||||||
this.navigateChannelShortcut = this.navigateChannelShortcut.bind(this);
|
this.navigateChannelShortcut = this.navigateChannelShortcut.bind(this);
|
||||||
this.navigateUnreadChannelShortcut = this.navigateUnreadChannelShortcut.bind(this);
|
this.navigateUnreadChannelShortcut = this.navigateUnreadChannelShortcut.bind(this);
|
||||||
this.getDisplayedChannels = this.getDisplayedChannels.bind(this);
|
this.getDisplayedChannels = this.getDisplayedChannels.bind(this);
|
||||||
this.compareByName = this.compareByName.bind(this);
|
|
||||||
this.compareByDisplayName = this.compareByDisplayName.bind(this);
|
this.compareByDisplayName = this.compareByDisplayName.bind(this);
|
||||||
|
|
||||||
const state = this.getStateFromStores();
|
const state = this.getStateFromStores();
|
||||||
@@ -182,7 +181,7 @@ export default class Navbar extends React.Component {
|
|||||||
nextIndex = curIndex - 1;
|
nextIndex = curIndex - 1;
|
||||||
}
|
}
|
||||||
nextChannel = allChannels[Utils.mod(nextIndex, allChannels.length)];
|
nextChannel = allChannels[Utils.mod(nextIndex, allChannels.length)];
|
||||||
GlobalActions.emitChannelClickEvent(nextChannel);
|
ChannelActions.goToChannel(nextChannel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
navigateUnreadChannelShortcut(e) {
|
navigateUnreadChannelShortcut(e) {
|
||||||
@@ -214,12 +213,12 @@ export default class Navbar extends React.Component {
|
|||||||
}
|
}
|
||||||
if (unreadCounts.msgs !== 0 || unreadCounts.mentions !== 0) {
|
if (unreadCounts.msgs !== 0 || unreadCounts.mentions !== 0) {
|
||||||
nextChannel = allChannels[nextIndex];
|
nextChannel = allChannels[nextIndex];
|
||||||
GlobalActions.emitChannelClickEvent(nextChannel);
|
ChannelActions.goToChannel(nextChannel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getDisplayedChannels() {
|
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 publicChannels = allChannels.filter((channel) => channel.type === Constants.OPEN_CHANNEL);
|
||||||
const privateChannels = allChannels.filter((channel) => channel.type === Constants.PRIVATE_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);
|
return publicChannels.concat(privateChannels).concat(directChannels).concat(directNonTeamChannels);
|
||||||
}
|
}
|
||||||
compareByName(a, b) {
|
compareByDisplayName(channelA, channelB) {
|
||||||
return a.name.localeCompare(b.name);
|
return channelA.display_name.localeCompare(channelB.display_name);
|
||||||
}
|
|
||||||
compareByDisplayName(a, b) {
|
|
||||||
return a.display_name.localeCompare(b.display_name);
|
|
||||||
}
|
}
|
||||||
createDropdown(channel, channelTitle, isAdmin, isDirect, popoverContent) {
|
createDropdown(channel, channelTitle, isAdmin, isDirect, popoverContent) {
|
||||||
if (channel) {
|
if (channel) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user