make resizeNotifier optional so tests don't fail

pull/21833/head
Bruno Windels 2019-03-28 17:56:12 +01:00
parent 82e44249ff
commit 41c5582a7b
2 changed files with 13 additions and 4 deletions

View File

@ -392,7 +392,9 @@ module.exports = React.createClass({
this._updateConfCallNotification(); this._updateConfCallNotification();
window.addEventListener('beforeunload', this.onPageUnload); window.addEventListener('beforeunload', this.onPageUnload);
if (this.props.resizeNotifier) {
this.props.resizeNotifier.on("middlePanelResized", this.onResize); this.props.resizeNotifier.on("middlePanelResized", this.onResize);
}
this.onResize(); this.onResize();
document.addEventListener("keydown", this.onKeyDown); document.addEventListener("keydown", this.onKeyDown);
@ -472,7 +474,9 @@ module.exports = React.createClass({
} }
window.removeEventListener('beforeunload', this.onPageUnload); window.removeEventListener('beforeunload', this.onPageUnload);
if (this.props.resizeNotifier) {
this.props.resizeNotifier.removeListener("middlePanelResized", this.onResize); this.props.resizeNotifier.removeListener("middlePanelResized", this.onResize);
}
document.removeEventListener("keydown", this.onKeyDown); document.removeEventListener("keydown", this.onKeyDown);

View File

@ -212,7 +212,9 @@ module.exports = React.createClass({
this._checkSubListsOverflow(); this._checkSubListsOverflow();
this.resizer.attach(); this.resizer.attach();
if (this.props.resizeNotifier) {
this.props.resizeNotifier.on("leftPanelResized", this.onResize); this.props.resizeNotifier.on("leftPanelResized", this.onResize);
}
this.mounted = true; this.mounted = true;
}, },
@ -271,7 +273,10 @@ module.exports = React.createClass({
MatrixClientPeg.get().removeListener("Group.myMembership", this._onGroupMyMembership); MatrixClientPeg.get().removeListener("Group.myMembership", this._onGroupMyMembership);
MatrixClientPeg.get().removeListener("RoomState.events", this.onRoomStateEvents); MatrixClientPeg.get().removeListener("RoomState.events", this.onRoomStateEvents);
} }
if (this.props.resizeNotifier) {
this.props.resizeNotifier.removeListener("leftPanelResized", this.onResize); this.props.resizeNotifier.removeListener("leftPanelResized", this.onResize);
}
if (this._tagStoreToken) { if (this._tagStoreToken) {