From f55b27f43281e860ca92b37635a8207907b9134d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 11 May 2017 17:32:23 +0100 Subject: [PATCH 1/5] looks like it is passed and accessed like a string so unless I'm going insane, it should be a string. fixes ``` rageshake.js:61 Warning: Failed prop type: The prop `onClick` is marked as required in `AccessibleButton`, but its value is `undefined`. in AccessibleButton (created by RoomHeader) in RoomHeader (created by RoomView) in div (created by RoomView) in RoomView (created by LoggedInView) in main (created by LoggedInView) in div (created by LoggedInView) in div (created by LoggedInView) in LoggedInView (created by MatrixChat) in MatrixChat ``` Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomPreviewBar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomPreviewBar.js b/src/components/views/rooms/RoomPreviewBar.js index 43c3b05295..5b7ec9347b 100644 --- a/src/components/views/rooms/RoomPreviewBar.js +++ b/src/components/views/rooms/RoomPreviewBar.js @@ -47,7 +47,7 @@ module.exports = React.createClass({ // The alias that was used to access this room, if appropriate // If given, this will be how the room is referred to (eg. // in error messages). - roomAlias: React.PropTypes.object, + roomAlias: React.PropTypes.string, }, getDefaultProps: function() { 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 2/5] 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 = + {roomName}; + + if (this.props.onSettingsClick) { + name =
{ innerName }{ searchStatus }
; + } else { + name =
{ innerName }{ searchStatus }
; + } - name = -
- {roomName} - { searchStatus } -
; } if (can_set_room_topic) { @@ -299,6 +305,14 @@ module.exports = React.createClass({ ; } + let search_button; + if (this.props.onSearchClick && this.props.inRoom) { + search_button = + + + ; + } + var rightPanel_buttons; if (this.props.collapsedRhs) { rightPanel_buttons = @@ -313,9 +327,7 @@ module.exports = React.createClass({
{ settings_button } { forget_button } - - - + { search_button } { rightPanel_buttons }
; } From 69d860e98207df27eaaefdb1a53f9e82918f94bc Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 12 May 2017 21:06:36 +0100 Subject: [PATCH 3/5] revert name overengineering, undefined onClick should be fine on div Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomHeader.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/components/views/rooms/RoomHeader.js b/src/components/views/rooms/RoomHeader.js index 5a7da47cbf..c10228c334 100644 --- a/src/components/views/rooms/RoomHeader.js +++ b/src/components/views/rooms/RoomHeader.js @@ -226,17 +226,11 @@ module.exports = React.createClass({ roomName = this.props.room.name; } - const innerName = - {roomName}; - - if (this.props.onSettingsClick) { - name =
{ innerName }{ searchStatus }
; - } else { - name =
{ innerName }{ searchStatus }
; - } - + name = +
+ {roomName} + { searchStatus } +
; } if (can_set_room_topic) { From 822f2f10f28a724654d3cc574ecc4672d7f243fa Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 12 May 2017 21:16:55 +0100 Subject: [PATCH 4/5] conform to Luke's comment https://github.com/matrix-org/matrix-react-sdk/pull/880#discussion_r116257726 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomHeader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomHeader.js b/src/components/views/rooms/RoomHeader.js index c10228c334..e9bb10c60c 100644 --- a/src/components/views/rooms/RoomHeader.js +++ b/src/components/views/rooms/RoomHeader.js @@ -228,7 +228,7 @@ module.exports = React.createClass({ name =
- {roomName} + { roomName } { searchStatus }
; } From 60b13d76a505fbc99940e72f425f21d7984bef1b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 12 May 2017 21:20:56 +0100 Subject: [PATCH 5/5] conform to Luke's other comment Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomHeader.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomHeader.js b/src/components/views/rooms/RoomHeader.js index e9bb10c60c..4cf20454a0 100644 --- a/src/components/views/rooms/RoomHeader.js +++ b/src/components/views/rooms/RoomHeader.js @@ -17,6 +17,7 @@ limitations under the License. 'use strict'; var React = require('react'); +var classNames = require('classnames'); var sdk = require('../../../index'); var MatrixClientPeg = require('../../../MatrixClientPeg'); var Modal = require("../../../Modal"); @@ -226,9 +227,10 @@ module.exports = React.createClass({ roomName = this.props.room.name; } + const emojiTextClasses = classNames('mx_RoomHeader_nametext', { mx_RoomHeader_settingsHint: settingsHint }); name =
- { roomName } + { roomName } { searchStatus }
; }