From 5e4467adced6ac7cd7eb8b20464efbeb0d8830db Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Thu, 11 May 2017 17:35:06 +0100
Subject: [PATCH] hide settings/search appropriately
pass inRoom prop to RoomHeader (defaults to false)
remove default onSettingsClick, handle if it is passed EVERYWHERE
if onSettingsClick is passes, show that button
show search button only if we are in the room, seems to fail otherwise
this seems to handle all cases I could throw at it. Give it your best
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/structures/RoomView.js | 1 +
src/components/views/rooms/RoomHeader.js | 30 +++++++++++++++++-------
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js
index 1b3ed6e80d..af0c595ea9 100644
--- a/src/components/structures/RoomView.js
+++ b/src/components/structures/RoomView.js
@@ -1772,6 +1772,7 @@ module.exports = React.createClass({
oobData={this.props.oobData}
editing={this.state.editingRoomSettings}
saving={this.state.uploadingRoomSettings}
+ inRoom={myMember && myMember.membership === 'join'}
collapsedRhs={ this.props.collapsedRhs }
onSearchClick={this.onSearchClick}
onSettingsClick={this.onSettingsClick}
diff --git a/src/components/views/rooms/RoomHeader.js b/src/components/views/rooms/RoomHeader.js
index 94f2691f2c..5a7da47cbf 100644
--- a/src/components/views/rooms/RoomHeader.js
+++ b/src/components/views/rooms/RoomHeader.js
@@ -39,6 +39,7 @@ module.exports = React.createClass({
oobData: React.PropTypes.object,
editing: React.PropTypes.bool,
saving: React.PropTypes.bool,
+ inRoom: React.PropTypes.bool,
collapsedRhs: React.PropTypes.bool,
onSettingsClick: React.PropTypes.func,
onSaveClick: React.PropTypes.func,
@@ -49,7 +50,7 @@ module.exports = React.createClass({
getDefaultProps: function() {
return {
editing: false,
- onSettingsClick: function() {},
+ inRoom: false,
onSaveClick: function() {},
};
},
@@ -225,12 +226,17 @@ module.exports = React.createClass({
roomName = this.props.room.name;
}
+ const innerName =
+