From baba500150790da725a9875cbcaa0c042bb656a7 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 8 Feb 2016 14:33:10 +0000 Subject: [PATCH 1/2] Filter rooms by ones we're in: getRooms() is not the set of rooms we are joined. Fixes https://github.com/vector-im/vector-web/issues/885 --- src/components/structures/RoomView.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index a13f29cbab..5fc9cc74e2 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -714,7 +714,9 @@ module.exports = React.createClass({ // NB. This unfortunately does not re-use the ChangeDisplayName component because // it doesn't behave quite as desired here (we want an input field here rather than // content-editable, and we want a default). - if (MatrixClientPeg.get().getRooms().length == 0) { + if (cli.getRooms().filter((r) => { + return !!r.getMember(cli.credentials.userId); + }).length == 0) { display_name_promise = cli.getProfileInfo(cli.credentials.userId).then((result) => { if (!result.displayname) { var SetDisplayNameDialog = sdk.getComponent('views.dialogs.SetDisplayNameDialog'); From 9bf8f37e5f2ed43e1922febf544715eef9b3e3c2 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 8 Feb 2016 16:03:04 +0000 Subject: [PATCH 2/2] explicitly check join status as it's clearer --- src/components/structures/RoomView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 5fc9cc74e2..be77a22101 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -715,8 +715,8 @@ module.exports = React.createClass({ // it doesn't behave quite as desired here (we want an input field here rather than // content-editable, and we want a default). if (cli.getRooms().filter((r) => { - return !!r.getMember(cli.credentials.userId); - }).length == 0) { + return r.hasMembershipState(cli.credentials.userId, "join"); + })) { display_name_promise = cli.getProfileInfo(cli.credentials.userId).then((result) => { if (!result.displayname) { var SetDisplayNameDialog = sdk.getComponent('views.dialogs.SetDisplayNameDialog');