From add91f9a7d930d439fe8d80d4f6d77c244cae284 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 21 Sep 2017 16:28:49 +0100 Subject: [PATCH 1/2] Update when a group arrives --- src/components/views/rooms/RoomList.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index ac0d3e047c..a6d34f9b08 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -89,6 +89,7 @@ module.exports = React.createClass({ cli.on("RoomMember.name", this.onRoomMemberName); cli.on("Event.decrypted", this.onEventDecrypted); cli.on("accountData", this.onAccountData); + cli.on("Group.myMembership", this._onGroupMyMembership); this.refreshRoomList(); @@ -157,6 +158,7 @@ module.exports = React.createClass({ MatrixClientPeg.get().removeListener("RoomMember.name", this.onRoomMemberName); MatrixClientPeg.get().removeListener("Event.decrypted", this.onEventDecrypted); MatrixClientPeg.get().removeListener("accountData", this.onAccountData); + MatrixClientPeg.get().removeListener("Group.myMembership", this._onGroupMyMembership); } // cancel any pending calls to the rate_limited_funcs this._delayedRefreshRoomList.cancelPendingCall(); @@ -236,6 +238,10 @@ module.exports = React.createClass({ } }, + _onGroupMyMembership: function(group) { + this.forceUpdate(); + }, + _delayedRefreshRoomList: new rate_limited_func(function() { this.refreshRoomList(); }, 500), From 3c2e6fdf9e39fc811c3fb1785141cd05a9a8651e Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 21 Sep 2017 16:55:56 +0100 Subject: [PATCH 2/2] Honour the is_privileged flag in GroupView --- src/components/structures/GroupView.js | 22 ++++++++++++++-------- src/i18n/strings/en_EN.json | 3 ++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 1b4b5cb809..ef56a90330 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -545,8 +545,12 @@ export default React.createClass({ ; } else if (group.myMembership === 'join') { + let youAreAMemberText = _t("You are a member of this group"); + if (this.state.summary.user && this.state.summary.user.is_privileged) { + youAreAMemberText = _t("You are an administrator of this group"); + } return
- {_t("You are a member of this group")} + {youAreAMemberText}
; - rightButtons.push( - - - , - ); + if (summary.user && summary.user.is_privileged) { + rightButtons.push( + + + , + ); + } if (this.props.collapsedRhs) { rightButtons.push(