From 6fc910a2594c9af00bf11cf5452419e08a979246 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 21 Jul 2015 11:12:59 -0700 Subject: [PATCH] Don't try to set page_type if not logged in --- src/controllers/pages/MatrixChat.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/controllers/pages/MatrixChat.js b/src/controllers/pages/MatrixChat.js index f72d793da..93865e730 100644 --- a/src/controllers/pages/MatrixChat.js +++ b/src/controllers/pages/MatrixChat.js @@ -40,12 +40,19 @@ module.exports = { }, getInitialState: function() { - return { + var s = { logged_in: !!(MatrixClientPeg.get() && MatrixClientPeg.get().credentials), ready: false, - page_type: MatrixClientPeg.get().getRooms().length ? this.PageTypes.RoomView : this.PageTypes.RoomDirectory, aux_panel: null, }; + if (s.logged_in) { + if (MatrixClientPeg.get().getRooms().length) { + s.page_type = this.PageTypes.RoomView; + } else { + s.page_type = this.PageTypes.RoomDirectory; + } + } + return s; }, componentDidMount: function() {