GH-4558 Mobile View: Don't close the Left Hand Sidebar after removing an open Direct Message Channel (#4776)

* added fix

* use class var instead of state var

* removed onUpdate
Этот коммит содержится в:
Nick Frazier
2016-12-19 16:46:52 -05:00
коммит произвёл Joram Wilander
родитель c8cd3d22ad
Коммит 2c15094368

Просмотреть файл

@@ -69,6 +69,7 @@ export default class Sidebar extends React.Component {
this.isLeaving = new Map(); this.isLeaving = new Map();
this.isSwitchingChannel = false; this.isSwitchingChannel = false;
this.closedDirectChannel = false;
const state = this.getStateFromStores(); const state = this.getStateFromStores();
state.newChannelModalType = ''; state.newChannelModalType = '';
@@ -161,9 +162,13 @@ export default class Sidebar extends React.Component {
// close the LHS on mobile when you change channels // close the LHS on mobile when you change channels
if (this.state.activeId !== prevState.activeId) { if (this.state.activeId !== prevState.activeId) {
$('.app__body .inner-wrap').removeClass('move--right'); if (this.closedDirectChannel) {
$('.app__body .sidebar--left').removeClass('move--right'); this.closedDirectChannel = false;
$('.multi-teams .team-sidebar').removeClass('move--right'); } else {
$('.app__body .inner-wrap').removeClass('move--right');
$('.app__body .sidebar--left').removeClass('move--right');
$('.multi-teams .team-sidebar').removeClass('move--right');
}
} }
} }
@@ -349,6 +354,7 @@ export default class Sidebar extends React.Component {
} }
if (channel.id === this.state.activeId) { if (channel.id === this.state.activeId) {
this.closedDirectChannel = true;
browserHistory.push('/' + this.state.currentTeam.name + '/channels/town-square'); browserHistory.push('/' + this.state.currentTeam.name + '/channels/town-square');
} }
} }