From 43f175892a25a1c9642c9a2e97fae90c22ac78f4 Mon Sep 17 00:00:00 2001 From: Faye Duxovni Date: Mon, 12 Dec 2022 17:43:29 -0500 Subject: [PATCH] Fix Prettier errors that slipped past CI (#9741) --- src/utils/EventUtils.ts | 2 +- ...houldDisplayAsVoiceBroadcastStoppedText.ts | 9 ++++--- .../textForVoiceBroadcastStoppedEvent.tsx | 24 +++++++------------ ...textForVoiceBroadcastStoppedEvent-test.tsx | 4 ++-- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/utils/EventUtils.ts b/src/utils/EventUtils.ts index 5858f2aaf42..eeebabd5c1b 100644 --- a/src/utils/EventUtils.ts +++ b/src/utils/EventUtils.ts @@ -31,7 +31,7 @@ import defaultDispatcher from "../dispatcher/dispatcher"; import { TimelineRenderingType } from "../contexts/RoomContext"; import { launchPollEditor } from "../components/views/messages/MPollBody"; import { Action } from "../dispatcher/actions"; -import { ViewRoomPayload } from '../dispatcher/payloads/ViewRoomPayload'; +import { ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload"; /** * Returns whether an event should allow actions like reply, reactions, edit, etc. diff --git a/src/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastStoppedText.ts b/src/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastStoppedText.ts index 81219b044af..22d6e79c37c 100644 --- a/src/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastStoppedText.ts +++ b/src/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastStoppedText.ts @@ -18,8 +18,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/matrix"; import { VoiceBroadcastInfoEventType, VoiceBroadcastInfoState } from ".."; -export const shouldDisplayAsVoiceBroadcastStoppedText = (event: MatrixEvent): boolean => ( - event.getType() === VoiceBroadcastInfoEventType - && event.getContent()?.state === VoiceBroadcastInfoState.Stopped - && !event.isRedacted() -); +export const shouldDisplayAsVoiceBroadcastStoppedText = (event: MatrixEvent): boolean => + event.getType() === VoiceBroadcastInfoEventType && + event.getContent()?.state === VoiceBroadcastInfoState.Stopped && + !event.isRedacted(); diff --git a/src/voice-broadcast/utils/textForVoiceBroadcastStoppedEvent.tsx b/src/voice-broadcast/utils/textForVoiceBroadcastStoppedEvent.tsx index 5c42c3e17ef..611908b7502 100644 --- a/src/voice-broadcast/utils/textForVoiceBroadcastStoppedEvent.tsx +++ b/src/voice-broadcast/utils/textForVoiceBroadcastStoppedEvent.tsx @@ -23,33 +23,27 @@ import { highlightEvent } from "../../utils/EventUtils"; import { getSenderName } from "../../TextForEvent"; import { _t } from "../../languageHandler"; -export const textForVoiceBroadcastStoppedEvent = (event: MatrixEvent): () => ReactNode => { +export const textForVoiceBroadcastStoppedEvent = (event: MatrixEvent): (() => ReactNode) => { return (): ReactNode => { const ownUserId = MatrixClientPeg.get()?.getUserId(); const startEventId = event.getRelation()?.event_id; const roomId = event.getRoomId(); const templateTags = { - a: (text: string) => startEventId && roomId - ? ( - highlightEvent(roomId, startEventId)} - > - { text } + a: (text: string) => + startEventId && roomId ? ( + highlightEvent(roomId, startEventId)}> + {text} - ) - : text, + ) : ( + text + ), }; if (ownUserId && ownUserId === event.getSender()) { return _t("You ended a voice broadcast", {}, templateTags); } - return _t( - "%(senderName)s ended a voice broadcast", - { senderName: getSenderName(event) }, - templateTags, - ); + return _t("%(senderName)s ended a voice broadcast", { senderName: getSenderName(event) }, templateTags); }; }; diff --git a/test/voice-broadcast/utils/textForVoiceBroadcastStoppedEvent-test.tsx b/test/voice-broadcast/utils/textForVoiceBroadcastStoppedEvent-test.tsx index 03fe525abc7..03593962821 100644 --- a/test/voice-broadcast/utils/textForVoiceBroadcastStoppedEvent-test.tsx +++ b/test/voice-broadcast/utils/textForVoiceBroadcastStoppedEvent-test.tsx @@ -16,7 +16,7 @@ limitations under the License. import React from "react"; import { render, RenderResult, screen } from "@testing-library/react"; -import userEvent from '@testing-library/user-event'; +import userEvent from "@testing-library/user-event"; import { mocked } from "jest-mock"; import { MatrixClient, RelationType } from "matrix-js-sdk/src/matrix"; @@ -48,7 +48,7 @@ describe("textForVoiceBroadcastStoppedEvent", () => { }; } - return render(
{ textForVoiceBroadcastStoppedEvent(event)() }
); + return render(
{textForVoiceBroadcastStoppedEvent(event)()}
); }; beforeEach(() => {