From a8ca6c18d5c907bccb3bfea8d4456d6c017f74ff Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 29 Nov 2021 15:55:11 +0000 Subject: [PATCH 1/2] Prevent duplicate avatars in Event List Summaries --- src/components/views/elements/EventListSummary.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/views/elements/EventListSummary.tsx b/src/components/views/elements/EventListSummary.tsx index 69ae1344cbe..4b465973d8a 100644 --- a/src/components/views/elements/EventListSummary.tsx +++ b/src/components/views/elements/EventListSummary.tsx @@ -23,6 +23,7 @@ import { _t } from '../../../languageHandler'; import { useStateToggle } from "../../../hooks/useStateToggle"; import AccessibleButton from "./AccessibleButton"; import { Layout } from '../../../settings/enums/Layout'; +import { uniqBy } from "lodash"; interface IProps { // An array of member events to summarise @@ -80,7 +81,8 @@ const EventListSummary: React.FC = ({ { children } ; } else { - const avatars = summaryMembers.map((m) => ); + const uniqueMembers = uniqBy(summaryMembers, member => member.getMxcAvatarUrl()); + const avatars = uniqueMembers.map((m) => ); body = (
From 6ba96babf4761e927cd373b2143427398d18a9b5 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 29 Nov 2021 15:56:22 +0000 Subject: [PATCH 2/2] delint --- src/components/views/elements/EventListSummary.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/elements/EventListSummary.tsx b/src/components/views/elements/EventListSummary.tsx index 4b465973d8a..e6041b0fffc 100644 --- a/src/components/views/elements/EventListSummary.tsx +++ b/src/components/views/elements/EventListSummary.tsx @@ -14,7 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React, { ReactNode, useEffect } from 'react'; +import React, { ReactNode, useEffect } from "react"; +import { uniqBy } from "lodash"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { RoomMember } from "matrix-js-sdk/src/models/room-member"; @@ -23,7 +24,6 @@ import { _t } from '../../../languageHandler'; import { useStateToggle } from "../../../hooks/useStateToggle"; import AccessibleButton from "./AccessibleButton"; import { Layout } from '../../../settings/enums/Layout'; -import { uniqBy } from "lodash"; interface IProps { // An array of member events to summarise