@@ -18,6 +18,7 @@ import React, { SyntheticEvent } from "react";
1818import classNames from "classnames" ;
1919import { MatrixEvent , MatrixEventEvent } from "matrix-js-sdk/src/models/event" ;
2020import { Relations , RelationsEvent } from "matrix-js-sdk/src/models/relations" ;
21+ import { uniqBy } from "lodash" ;
2122
2223import { _t } from "../../../languageHandler" ;
2324import { isContentActionable } from "../../../utils/EventUtils" ;
@@ -177,6 +178,10 @@ export default class ReactionsRow extends React.PureComponent<IProps, IState> {
177178 if ( ! count ) {
178179 return null ;
179180 }
181+ // Deduplicate the events as per the spec https://spec.matrix.org/v1.7/client-server-api/#annotations-client-behaviour
182+ // This isn't done by the underlying data model as applications may still need access to the whole list of events
183+ // for moderation purposes.
184+ const deduplicatedEvents = uniqBy ( [ ...events ] , ( e ) => e . getSender ( ) ) ;
180185 const myReactionEvent = myReactions ?. find ( ( mxEvent ) => {
181186 if ( mxEvent . isRedacted ( ) ) {
182187 return false ;
@@ -187,9 +192,9 @@ export default class ReactionsRow extends React.PureComponent<IProps, IState> {
187192 < ReactionsRowButton
188193 key = { content }
189194 content = { content }
190- count = { count }
195+ count = { deduplicatedEvents . length }
191196 mxEvent = { mxEvent }
192- reactionEvents = { events }
197+ reactionEvents = { deduplicatedEvents }
193198 myReactionEvent = { myReactionEvent }
194199 disabled = {
195200 ! this . context . canReact ||
0 commit comments