From 41c5582a7b46835dbaae775569758b6d52e9d993 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 28 Mar 2019 17:56:12 +0100 Subject: [PATCH] make resizeNotifier optional so tests don't fail --- src/components/structures/RoomView.js | 8 ++++++-- src/components/views/rooms/RoomList.js | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index ba6b54bdbc..cfc645abb4 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -392,7 +392,9 @@ module.exports = React.createClass({ this._updateConfCallNotification(); window.addEventListener('beforeunload', this.onPageUnload); - this.props.resizeNotifier.on("middlePanelResized", this.onResize); + if (this.props.resizeNotifier) { + this.props.resizeNotifier.on("middlePanelResized", this.onResize); + } this.onResize(); document.addEventListener("keydown", this.onKeyDown); @@ -472,7 +474,9 @@ module.exports = React.createClass({ } window.removeEventListener('beforeunload', this.onPageUnload); - this.props.resizeNotifier.removeListener("middlePanelResized", this.onResize); + if (this.props.resizeNotifier) { + this.props.resizeNotifier.removeListener("middlePanelResized", this.onResize); + } document.removeEventListener("keydown", this.onKeyDown); diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 2de9918e6e..33b97964f6 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -212,7 +212,9 @@ module.exports = React.createClass({ this._checkSubListsOverflow(); this.resizer.attach(); - this.props.resizeNotifier.on("leftPanelResized", this.onResize); + if (this.props.resizeNotifier) { + this.props.resizeNotifier.on("leftPanelResized", this.onResize); + } this.mounted = true; }, @@ -271,7 +273,10 @@ module.exports = React.createClass({ MatrixClientPeg.get().removeListener("Group.myMembership", this._onGroupMyMembership); MatrixClientPeg.get().removeListener("RoomState.events", this.onRoomStateEvents); } - this.props.resizeNotifier.removeListener("leftPanelResized", this.onResize); + + if (this.props.resizeNotifier) { + this.props.resizeNotifier.removeListener("leftPanelResized", this.onResize); + } if (this._tagStoreToken) {