Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 1c6015c

Browse files
committed
fixup! Include custom reaction short names in tooltips
Signed-off-by: Sumner Evans <me@sumnerevans.com>
1 parent 1e11e55 commit 1c6015c

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/components/views/messages/ReactionsRowButtonTooltip.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { _t } from "../../../languageHandler";
2222
import { formatCommaSeparatedList } from "../../../utils/FormattingUtils";
2323
import Tooltip from "../elements/Tooltip";
2424
import MatrixClientContext from "../../../contexts/MatrixClientContext";
25+
2526
interface IProps {
2627
// The event we're displaying reactions for
2728
mxEvent: MatrixEvent;
@@ -32,16 +33,6 @@ interface IProps {
3233
visible: boolean;
3334
}
3435

35-
const getCustomReactionName = (reactionEvents: Set<MatrixEvent>): string => {
36-
for (const event of reactionEvents) {
37-
if (event.event.content?.["com.beeper.reaction.shortcode"]) {
38-
return event.event.content?.["com.beeper.reaction.shortcode"];
39-
}
40-
}
41-
42-
return '';
43-
};
44-
4536
export default class ReactionsRowButtonTooltip extends React.PureComponent<IProps> {
4637
public static contextType = MatrixClientContext;
4738
public context!: React.ContextType<typeof MatrixClientContext>;
@@ -53,12 +44,16 @@ export default class ReactionsRowButtonTooltip extends React.PureComponent<IProp
5344
let tooltipLabel: JSX.Element | undefined;
5445
if (room) {
5546
const senders: string[] = [];
47+
let customReactionName = '';
5648
for (const reactionEvent of reactionEvents) {
5749
const member = room.getMember(reactionEvent.getSender()!);
5850
const name = member?.name ?? reactionEvent.getSender()!;
5951
senders.push(name);
52+
if (reactionEvent.event.content?.["com.beeper.reaction.shortcode"]) {
53+
customReactionName = reactionEvent.event.content?.["com.beeper.reaction.shortcode"];
54+
}
6055
}
61-
const shortName = unicodeToShortcode(content) || getCustomReactionName(reactionEvents);
56+
const shortName = unicodeToShortcode(content) || customReactionName;
6257
tooltipLabel = (
6358
<div>
6459
{_t(

0 commit comments

Comments
 (0)