Add a way to jump to a user's Read Receipt from MemberInfo
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
2ba0a801c4
commit
d54cea5429
1 changed files with 31 additions and 4 deletions
|
@ -628,23 +628,50 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
_renderUserOptions: function() {
|
_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;
|
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 = (
|
ignoreButton = (
|
||||||
<AccessibleButton onClick={this.onIgnoreToggle} className="mx_MemberInfo_field">
|
<AccessibleButton onClick={this.onIgnoreToggle} className="mx_MemberInfo_field">
|
||||||
{this.state.isIgnoring ? _t("Unignore") : _t("Ignore")}
|
{this.state.isIgnoring ? _t("Unignore") : _t("Ignore")}
|
||||||
</AccessibleButton>
|
</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">
|
||||||
|
Jump to read receipt
|
||||||
|
</AccessibleButton>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignoreButton) return null;
|
if (!ignoreButton && !readReceiptButton) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h3>{ _t("User Options") }</h3>
|
<h3>{ _t("User Options") }</h3>
|
||||||
<div className="mx_MemberInfo_buttons">
|
<div className="mx_MemberInfo_buttons">
|
||||||
{ignoreButton}
|
{ readReceiptButton }
|
||||||
|
{ ignoreButton }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue