From d54cea54298041379738367ae2996de8643c3368 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sat, 7 Oct 2017 19:25:13 +0100
Subject: [PATCH 1/2] Add a way to jump to a user's Read Receipt from
MemberInfo
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/views/rooms/MemberInfo.js | 35 +++++++++++++++++++++---
1 file changed, 31 insertions(+), 4 deletions(-)
diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js
index f705cf97d2..83f4f7e4c6 100644
--- a/src/components/views/rooms/MemberInfo.js
+++ b/src/components/views/rooms/MemberInfo.js
@@ -628,23 +628,50 @@ module.exports = withMatrixClient(React.createClass({
},
_renderUserOptions: function() {
- // Only allow the user to ignore the user if its not ourselves
+ const cli = this.props.matrixClient;
+ const member = this.props.member;
+
let ignoreButton = null;
- if (this.props.member.userId !== this.props.matrixClient.getUserId()) {
+ let readReceiptButton = null;
+
+ // Only allow the user to ignore the user if its not ourselves
+ // same goes for jumping to read receipt
+ if (member.userId !== cli.getUserId()) {
ignoreButton = (
{this.state.isIgnoring ? _t("Unignore") : _t("Ignore")}
);
+
+ if (member.roomId) {
+ const room = cli.getRoom(member.roomId);
+ const eventId = room.getEventReadUpTo(member.userId);
+
+ const onReadReceiptButton = function() {
+ dis.dispatch({
+ action: 'view_room',
+ highlighted: true,
+ event_id: eventId,
+ room_id: member.roomId,
+ });
+ };
+
+ readReceiptButton = (
+
+ Jump to read receipt
+
+ );
+ }
}
- if (!ignoreButton) return null;
+ if (!ignoreButton && !readReceiptButton) return null;
return (
{ _t("User Options") }
- {ignoreButton}
+ { readReceiptButton }
+ { ignoreButton }
);
From dbb6f5a44d2cdc4b0531c245fcd0b5fa1575d11a Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sat, 7 Oct 2017 19:27:49 +0100
Subject: [PATCH 2/2] i18n the Jump to Read Receipt in MemberInfo
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/views/rooms/MemberInfo.js | 4 ++--
src/i18n/strings/en_EN.json | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js
index 83f4f7e4c6..5dfdeb303b 100644
--- a/src/components/views/rooms/MemberInfo.js
+++ b/src/components/views/rooms/MemberInfo.js
@@ -639,7 +639,7 @@ module.exports = withMatrixClient(React.createClass({
if (member.userId !== cli.getUserId()) {
ignoreButton = (
- {this.state.isIgnoring ? _t("Unignore") : _t("Ignore")}
+ { this.state.isIgnoring ? _t("Unignore") : _t("Ignore") }
);
@@ -658,7 +658,7 @@ module.exports = withMatrixClient(React.createClass({
readReceiptButton = (
- Jump to read receipt
+ { _t('Jump to read receipt') }
);
}
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 6acaba9fae..5ebf6116ee 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -249,6 +249,7 @@
"%(targetName)s joined the room.": "%(targetName)s joined the room.",
"Joins room with given alias": "Joins room with given alias",
"Jump to first unread message.": "Jump to first unread message.",
+ "Jump to read receipt": "Jump to read receipt",
"%(senderName)s kicked %(targetName)s.": "%(senderName)s kicked %(targetName)s.",
"Kick": "Kick",
"Kicks user with given id": "Kicks user with given id",