Merge pull request #1454 from matrix-org/t3chguy/jump_to_rr

Add a way to jump to a user's Read Receipt from MemberInfo
pull/21833/head
Matthew Hodgson 2017-10-14 23:45:49 +01:00 committed by GitHub
commit b552b45a96
2 changed files with 31 additions and 3 deletions

View File

@ -625,22 +625,49 @@ 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 = (
<AccessibleButton onClick={this.onIgnoreToggle} className="mx_MemberInfo_field">
{ this.state.isIgnoring ? _t("Unignore") : _t("Ignore") }
</AccessibleButton>
);
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 = (
<AccessibleButton onClick={onReadReceiptButton} className="mx_MemberInfo_field">
{ _t('Jump to read receipt') }
</AccessibleButton>
);
}
}
if (!ignoreButton) return null;
if (!ignoreButton && !readReceiptButton) return null;
return (
<div>
<h3>{ _t("User Options") }</h3>
<div className="mx_MemberInfo_buttons">
{ readReceiptButton }
{ ignoreButton }
</div>
</div>

View File

@ -252,6 +252,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",