@@ -22,6 +22,7 @@ import { _t } from "../../../languageHandler";
2222import { formatCommaSeparatedList } from "../../../utils/FormattingUtils" ;
2323import Tooltip from "../elements/Tooltip" ;
2424import MatrixClientContext from "../../../contexts/MatrixClientContext" ;
25+
2526interface 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-
4536export 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