Merge pull request #1532 from matrix-org/t3chguy/mention_user

Add Mention button to MemberInfo
This commit is contained in:
David Baker 2017-10-26 18:38:28 +01:00 committed by GitHub
commit 1715206f62
2 changed files with 17 additions and 1 deletions

View file

@ -621,6 +621,7 @@ module.exports = withMatrixClient(React.createClass({
const member = this.props.member; const member = this.props.member;
let ignoreButton = null; let ignoreButton = null;
let insertPillButton = null;
let inviteUserButton = null; let inviteUserButton = null;
let readReceiptButton = null; let readReceiptButton = null;
@ -646,11 +647,24 @@ module.exports = withMatrixClient(React.createClass({
}); });
}; };
const onInsertPillButton = function() {
dis.dispatch({
action: 'insert_mention',
user_id: member.userId,
});
};
readReceiptButton = ( readReceiptButton = (
<AccessibleButton onClick={onReadReceiptButton} className="mx_MemberInfo_field"> <AccessibleButton onClick={onReadReceiptButton} className="mx_MemberInfo_field">
{ _t('Jump to read receipt') } { _t('Jump to read receipt') }
</AccessibleButton> </AccessibleButton>
); );
insertPillButton = (
<AccessibleButton onClick={onInsertPillButton} className={"mx_MemberInfo_field"}>
{ _t('Mention') }
</AccessibleButton>
);
} }
if (!member || !member.membership || member.membership === 'leave') { if (!member || !member.membership || member.membership === 'leave') {
@ -675,13 +689,14 @@ module.exports = withMatrixClient(React.createClass({
} }
} }
if (!ignoreButton && !readReceiptButton && !inviteUserButton) return null; if (!ignoreButton && !readReceiptButton && !insertPillButton && !inviteUserButton) 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">
{ readReceiptButton } { readReceiptButton }
{ insertPillButton }
{ ignoreButton } { ignoreButton }
{ inviteUserButton } { inviteUserButton }
</div> </div>

View file

@ -152,6 +152,7 @@
"%(widgetName)s widget removed by %(senderName)s": "%(widgetName)s widget removed by %(senderName)s", "%(widgetName)s widget removed by %(senderName)s": "%(widgetName)s widget removed by %(senderName)s",
"Communities": "Communities", "Communities": "Communities",
"Message Pinning": "Message Pinning", "Message Pinning": "Message Pinning",
"Mention": "Mention",
"%(displayName)s is typing": "%(displayName)s is typing", "%(displayName)s is typing": "%(displayName)s is typing",
"%(names)s and one other are typing": "%(names)s and one other are typing", "%(names)s and one other are typing": "%(names)s and one other are typing",
"%(names)s and %(count)s others are typing|other": "%(names)s and %(count)s others are typing", "%(names)s and %(count)s others are typing|other": "%(names)s and %(count)s others are typing",