@@ -22,6 +22,7 @@ import { _t } from "../../../languageHandler";
22
22
import { formatCommaSeparatedList } from "../../../utils/FormattingUtils" ;
23
23
import Tooltip from "../elements/Tooltip" ;
24
24
import MatrixClientContext from "../../../contexts/MatrixClientContext" ;
25
+
25
26
interface IProps {
26
27
// The event we're displaying reactions for
27
28
mxEvent : MatrixEvent ;
@@ -32,16 +33,6 @@ interface IProps {
32
33
visible : boolean ;
33
34
}
34
35
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
-
45
36
export default class ReactionsRowButtonTooltip extends React . PureComponent < IProps > {
46
37
public static contextType = MatrixClientContext ;
47
38
public context ! : React . ContextType < typeof MatrixClientContext > ;
@@ -53,12 +44,16 @@ export default class ReactionsRowButtonTooltip extends React.PureComponent<IProp
53
44
let tooltipLabel : JSX . Element | undefined ;
54
45
if ( room ) {
55
46
const senders : string [ ] = [ ] ;
47
+ let customReactionName = '' ;
56
48
for ( const reactionEvent of reactionEvents ) {
57
49
const member = room . getMember ( reactionEvent . getSender ( ) ! ) ;
58
50
const name = member ?. name ?? reactionEvent . getSender ( ) ! ;
59
51
senders . push ( name ) ;
52
+ if ( reactionEvent . event . content ?. [ "com.beeper.reaction.shortcode" ] ) {
53
+ customReactionName = reactionEvent . event . content ?. [ "com.beeper.reaction.shortcode" ] ;
54
+ }
60
55
}
61
- const shortName = unicodeToShortcode ( content ) || getCustomReactionName ( reactionEvents ) ;
56
+ const shortName = unicodeToShortcode ( content ) || customReactionName ;
62
57
tooltipLabel = (
63
58
< div >
64
59
{ _t (
0 commit comments