From d9d25e26d27fde690502a3830acaeb91dd300157 Mon Sep 17 00:00:00 2001 From: turt2live Date: Mon, 29 May 2017 23:21:14 -0600 Subject: [PATCH 1/4] Say "X removed the room name" instead of showing nothing Addresses vector-im/riot-web#4072 Signed-off-by: Travis Ralston --- src/TextForEvent.js | 5 ++++- src/i18n/strings/en_EN.json | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/TextForEvent.js b/src/TextForEvent.js index 6438a9a1ad..fa78f9d61b 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -117,7 +117,10 @@ function textForTopicEvent(ev) { function textForRoomNameEvent(ev) { var senderDisplayName = ev.sender && ev.sender.name ? ev.sender.name : ev.getSender(); - + + if (!ev.getContent().name || ev.getContent().name.trim().length === 0) { + return _t('%(senderDisplayName)s removed the room name.', {senderDisplayName: senderDisplayName}); + } return _t('%(senderDisplayName)s changed the room name to %(roomName)s.', {senderDisplayName: senderDisplayName, roomName: ev.getContent().name}); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 5abb27e2b7..527219b4a6 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -174,6 +174,7 @@ "%(senderName)s changed their profile picture.": "%(senderName)s changed their profile picture.", "%(senderName)s changed the power level of %(powerLevelDiffText)s.": "%(senderName)s changed the power level of %(powerLevelDiffText)s.", "%(senderDisplayName)s changed the room name to %(roomName)s.": "%(senderDisplayName)s changed the room name to %(roomName)s.", + "%(senderDisplayName)s removed the room name.": "%(senderDisplayName)s removed the room name.", "%(senderDisplayName)s changed the topic to \"%(topic)s\".": "%(senderDisplayName)s changed the topic to \"%(topic)s\".", "Changes to who can read history will only apply to future messages in this room": "Changes to who can read history will only apply to future messages in this room", "Changes your display nickname": "Changes your display nickname", From ff9141e424777ea7f052d93876393cb36da87964 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 30 May 2017 11:20:41 +0100 Subject: [PATCH 2/4] add a hideCancel flag as some things have own cancel etc on RoomHeader Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomView.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index e939510c72..2d5cfff8e0 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -1622,6 +1622,7 @@ module.exports = React.createClass({ } let aux = null; + let hideCancel = false; if (this.state.forwardingEvent !== null) { aux = ; } else if (this.state.editingRoomSettings) { @@ -1629,6 +1630,7 @@ module.exports = React.createClass({ } else if (this.state.uploadingRoomSettings) { aux = ; } else if (this.state.searching) { + hideCancel = true; // has own cancel aux = ; } else if (!myMember || myMember.membership !== "join") { // We do have a room object for this room, but we're not currently in it. @@ -1641,6 +1643,7 @@ module.exports = React.createClass({ if (this.props.thirdPartyInvite) { invitedEmail = this.props.thirdPartyInvite.invitedEmail; } + hideCancel = true; aux = ( + onCancelClick={(aux && !hideCancel) ? this.onCancelClick : null} + onForgetClick={(myMember && myMember.membership === "leave") ? this.onForgetClick : null} + onLeaveClick={(myMember && myMember.membership === "join") ? this.onLeaveClick : null} + /> { auxPanel } { topUnreadMessagesBar } { messagePanel } From baba2e12e297f4f87aaea5fcf5fb145ec9c03882 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 30 May 2017 11:21:33 +0100 Subject: [PATCH 3/4] fix weird indentation Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomView.js | 77 +++++++++++++-------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 2d5cfff8e0..817fe42e94 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -1496,49 +1496,48 @@ module.exports = React.createClass({ const TimelinePanel = sdk.getComponent("structures.TimelinePanel"); if (!this.state.room) { - if (this.state.roomLoading) { - return ( -
- -
- ); + if (this.state.roomLoading) { + return ( +
+ +
+ ); + } else { + var inviterName = undefined; + if (this.props.oobData) { + inviterName = this.props.oobData.inviterName; + } + var invitedEmail = undefined; + if (this.props.thirdPartyInvite) { + invitedEmail = this.props.thirdPartyInvite.invitedEmail; } - else { - var inviterName = undefined; - if (this.props.oobData) { - inviterName = this.props.oobData.inviterName; - } - var invitedEmail = undefined; - if (this.props.thirdPartyInvite) { - invitedEmail = this.props.thirdPartyInvite.invitedEmail; - } - // We have no room object for this room, only the ID. - // We've got to this room by following a link, possibly a third party invite. - var room_alias = this.props.roomAddress[0] == '#' ? this.props.roomAddress : null; - return ( -
- + +
+ -
- -
-
- ); - } +
+
+ ); + } } var myUserId = MatrixClientPeg.get().credentials.userId; From ee6789ed15d76daac9aa18271ffec6515bf3b34b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 30 May 2017 11:22:27 +0100 Subject: [PATCH 4/4] change aux order so room settings is top most, forwarding could go weird if you clicked roomsettings whilst forwarding Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomView.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 817fe42e94..77ea8d945a 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -1622,12 +1622,12 @@ module.exports = React.createClass({ let aux = null; let hideCancel = false; - if (this.state.forwardingEvent !== null) { - aux = ; - } else if (this.state.editingRoomSettings) { + if (this.state.editingRoomSettings) { aux = ; } else if (this.state.uploadingRoomSettings) { aux = ; + } else if (this.state.forwardingEvent !== null) { + aux = ; } else if (this.state.searching) { hideCancel = true; // has own cancel aux = ;