From 97ce84c8e36eaf20c0306242a4700c03e9419ef6 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sun, 11 Feb 2018 16:14:17 +1300 Subject: [PATCH 1/4] Add display name to the read receipt view Show the user's display name (aka nick) in the ReadReceiptMarker title (mouseover text), and then the user ID in parentheses. --- src/components/views/rooms/ReadReceiptMarker.js | 6 ++++-- src/i18n/strings/en_EN.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/ReadReceiptMarker.js b/src/components/views/rooms/ReadReceiptMarker.js index 5dd62ff6b7..d5436efc76 100644 --- a/src/components/views/rooms/ReadReceiptMarker.js +++ b/src/components/views/rooms/ReadReceiptMarker.js @@ -186,8 +186,10 @@ module.exports = React.createClass({ let title; if (this.props.timestamp) { title = _t( - "Seen by %(userName)s at %(dateTime)s", - {userName: this.props.member.userId, dateTime: formatDate(new Date(this.props.timestamp), this.props.showTwelveHour)}, + "Seen by %(displayName)s (%(userName)s) at %(dateTime)s", + {displayName: this.props.member.name, + userName: this.props.member.userId, + dateTime: formatDate(new Date(this.props.timestamp), this.props.showTwelveHour)}, ); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 6139ac2a91..2be4bf2e48 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -360,7 +360,7 @@ "Offline": "Offline", "Unknown": "Unknown", "Replying": "Replying", - "Seen by %(userName)s at %(dateTime)s": "Seen by %(userName)s at %(dateTime)s", + "Seen by %(displayName)s (%(userName)s) at %(dateTime)s": "Seen by %(displayName)s (%(userName)s) at %(dateTime)s", "No rooms to show": "No rooms to show", "Unnamed room": "Unnamed room", "World readable": "World readable", From 0fd9b3e9b2d89965bb3966839d8f55700e17e7b9 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sun, 11 Feb 2018 16:27:07 +1300 Subject: [PATCH 2/4] Avoid doubling up username in read receipt view In the ReadReceiptMarker title, use the RoomMember.rawDisplayName because RoomMember.name may already include the username, which we are going to add ourselves. --- src/components/views/rooms/ReadReceiptMarker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/ReadReceiptMarker.js b/src/components/views/rooms/ReadReceiptMarker.js index d5436efc76..8dc3c0f7d0 100644 --- a/src/components/views/rooms/ReadReceiptMarker.js +++ b/src/components/views/rooms/ReadReceiptMarker.js @@ -187,7 +187,7 @@ module.exports = React.createClass({ if (this.props.timestamp) { title = _t( "Seen by %(displayName)s (%(userName)s) at %(dateTime)s", - {displayName: this.props.member.name, + {displayName: this.props.member.rawDisplayName, userName: this.props.member.userId, dateTime: formatDate(new Date(this.props.timestamp), this.props.showTwelveHour)}, ); From 3d4feac75b63cef7b688492fb096f10236fcf3fc Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Fri, 23 Mar 2018 17:14:29 +1300 Subject: [PATCH 3/4] Don't try to show unset display name In the ReadReceiptMarker title, show the display name only when it is not the same as the user ID. --- .../views/rooms/ReadReceiptMarker.js | 22 ++++++++++++++----- src/i18n/strings/en_EN.json | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/components/views/rooms/ReadReceiptMarker.js b/src/components/views/rooms/ReadReceiptMarker.js index 8dc3c0f7d0..8b66cfd808 100644 --- a/src/components/views/rooms/ReadReceiptMarker.js +++ b/src/components/views/rooms/ReadReceiptMarker.js @@ -185,12 +185,22 @@ module.exports = React.createClass({ let title; if (this.props.timestamp) { - title = _t( - "Seen by %(displayName)s (%(userName)s) at %(dateTime)s", - {displayName: this.props.member.rawDisplayName, - userName: this.props.member.userId, - dateTime: formatDate(new Date(this.props.timestamp), this.props.showTwelveHour)}, - ); + const dateString = formatDate(new Date(this.props.timestamp), this.props.showTwelveHour); + if (this.props.member.userId === this.props.member.rawDisplayName) { + title = _t( + "Seen by %(userName)s at %(dateTime)s", + {userName: this.props.member.userId, + dateTime: dateString}, + ); + } + else { + title = _t( + "Seen by %(displayName)s (%(userName)s) at %(dateTime)s", + {displayName: this.props.member.rawDisplayName, + userName: this.props.member.userId, + dateTime: dateString}, + ); + } } return ( diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 2754880ed7..2d3ef836e0 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -389,6 +389,7 @@ "Offline": "Offline", "Unknown": "Unknown", "Replying": "Replying", + "Seen by %(userName)s at %(dateTime)s": "Seen by %(userName)s at %(dateTime)s", "Seen by %(displayName)s (%(userName)s) at %(dateTime)s": "Seen by %(displayName)s (%(userName)s) at %(dateTime)s", "No rooms to show": "No rooms to show", "Unnamed room": "Unnamed room", From 0a920ae8012b69f9363a8463aa12e9a97521fedc Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 26 Mar 2018 13:33:47 +0100 Subject: [PATCH 4/4] Indenting fix --- src/components/views/rooms/ReadReceiptMarker.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/views/rooms/ReadReceiptMarker.js b/src/components/views/rooms/ReadReceiptMarker.js index 8b66cfd808..0029395d3d 100644 --- a/src/components/views/rooms/ReadReceiptMarker.js +++ b/src/components/views/rooms/ReadReceiptMarker.js @@ -192,8 +192,7 @@ module.exports = React.createClass({ {userName: this.props.member.userId, dateTime: dateString}, ); - } - else { + } else { title = _t( "Seen by %(displayName)s (%(userName)s) at %(dateTime)s", {displayName: this.props.member.rawDisplayName,