diff --git a/src/components/views/messages/ReactionsRow.js b/src/components/views/messages/ReactionsRow.js index 0abb1015b9..3a8cd24518 100644 --- a/src/components/views/messages/ReactionsRow.js +++ b/src/components/views/messages/ReactionsRow.js @@ -149,7 +149,11 @@ export default class ReactionsRow extends React.PureComponent { ; } - return
+ return
{items} {showAllButton}
; diff --git a/src/components/views/messages/ReactionsRowButton.js b/src/components/views/messages/ReactionsRowButton.js index ac44ec5d56..10dea34809 100644 --- a/src/components/views/messages/ReactionsRowButton.js +++ b/src/components/views/messages/ReactionsRowButton.js @@ -20,6 +20,8 @@ import classNames from 'classnames'; import MatrixClientPeg from '../../../MatrixClientPeg'; import sdk from '../../../index'; +import { _t } from '../../../languageHandler'; +import { formatCommaSeparatedList } from '../../../utils/FormattingUtils'; export default class ReactionsRowButton extends React.PureComponent { static propTypes = { @@ -79,7 +81,7 @@ export default class ReactionsRowButton extends React.PureComponent { render() { const ReactionsRowButtonTooltip = sdk.getComponent('messages.ReactionsRowButtonTooltip'); - const { content, count, reactionEvents, myReactionEvent } = this.props; + const { mxEvent, content, count, reactionEvents, myReactionEvent } = this.props; const classes = classNames({ mx_ReactionsRowButton: true, @@ -96,15 +98,46 @@ export default class ReactionsRowButton extends React.PureComponent { />; } + const room = MatrixClientPeg.get().getRoom(mxEvent.getRoomId()); + let label; + if (room) { + const senders = []; + for (const reactionEvent of reactionEvents) { + const member = room.getMember(reactionEvent.getSender()); + const name = member ? member.name : reactionEvent.getSender(); + senders.push(name); + } + label = _t( + " reacted with %(content)s", + { + content, + }, + { + reactors: () => { + return formatCommaSeparatedList(senders, 6); + }, + reactedWith: (sub) => { + if (!content) { + return null; + } + return sub; + }, + }, + ); + } + return - + - + {tooltip} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 03838de292..182c761c5f 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1117,6 +1117,8 @@ "You sent a verification request": "You sent a verification request", "Error decrypting video": "Error decrypting video", "Show all": "Show all", + "Reactions": "Reactions", + " reacted with %(content)s": " reacted with %(content)s", "reacted with %(shortName)s": "reacted with %(shortName)s", "%(senderDisplayName)s changed the avatar for %(roomName)s": "%(senderDisplayName)s changed the avatar for %(roomName)s", "%(senderDisplayName)s removed the room avatar.": "%(senderDisplayName)s removed the room avatar.",