Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 43f1758

Browse files
authored
Fix Prettier errors that slipped past CI (#9741)
1 parent d835721 commit 43f1758

File tree

4 files changed

+16
-23
lines changed

4 files changed

+16
-23
lines changed

src/utils/EventUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import defaultDispatcher from "../dispatcher/dispatcher";
3131
import { TimelineRenderingType } from "../contexts/RoomContext";
3232
import { launchPollEditor } from "../components/views/messages/MPollBody";
3333
import { Action } from "../dispatcher/actions";
34-
import { ViewRoomPayload } from '../dispatcher/payloads/ViewRoomPayload';
34+
import { ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload";
3535

3636
/**
3737
* Returns whether an event should allow actions like reply, reactions, edit, etc.

src/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastStoppedText.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/matrix";
1818

1919
import { VoiceBroadcastInfoEventType, VoiceBroadcastInfoState } from "..";
2020

21-
export const shouldDisplayAsVoiceBroadcastStoppedText = (event: MatrixEvent): boolean => (
22-
event.getType() === VoiceBroadcastInfoEventType
23-
&& event.getContent()?.state === VoiceBroadcastInfoState.Stopped
24-
&& !event.isRedacted()
25-
);
21+
export const shouldDisplayAsVoiceBroadcastStoppedText = (event: MatrixEvent): boolean =>
22+
event.getType() === VoiceBroadcastInfoEventType &&
23+
event.getContent()?.state === VoiceBroadcastInfoState.Stopped &&
24+
!event.isRedacted();

src/voice-broadcast/utils/textForVoiceBroadcastStoppedEvent.tsx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,27 @@ import { highlightEvent } from "../../utils/EventUtils";
2323
import { getSenderName } from "../../TextForEvent";
2424
import { _t } from "../../languageHandler";
2525

26-
export const textForVoiceBroadcastStoppedEvent = (event: MatrixEvent): () => ReactNode => {
26+
export const textForVoiceBroadcastStoppedEvent = (event: MatrixEvent): (() => ReactNode) => {
2727
return (): ReactNode => {
2828
const ownUserId = MatrixClientPeg.get()?.getUserId();
2929
const startEventId = event.getRelation()?.event_id;
3030
const roomId = event.getRoomId();
3131

3232
const templateTags = {
33-
a: (text: string) => startEventId && roomId
34-
? (
35-
<AccessibleButton
36-
kind="link_inline"
37-
onClick={() => highlightEvent(roomId, startEventId)}
38-
>
39-
{ text }
33+
a: (text: string) =>
34+
startEventId && roomId ? (
35+
<AccessibleButton kind="link_inline" onClick={() => highlightEvent(roomId, startEventId)}>
36+
{text}
4037
</AccessibleButton>
41-
)
42-
: text,
38+
) : (
39+
text
40+
),
4341
};
4442

4543
if (ownUserId && ownUserId === event.getSender()) {
4644
return _t("You ended a <a>voice broadcast</a>", {}, templateTags);
4745
}
4846

49-
return _t(
50-
"%(senderName)s ended a <a>voice broadcast</a>",
51-
{ senderName: getSenderName(event) },
52-
templateTags,
53-
);
47+
return _t("%(senderName)s ended a <a>voice broadcast</a>", { senderName: getSenderName(event) }, templateTags);
5448
};
5549
};

test/voice-broadcast/utils/textForVoiceBroadcastStoppedEvent-test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616

1717
import React from "react";
1818
import { render, RenderResult, screen } from "@testing-library/react";
19-
import userEvent from '@testing-library/user-event';
19+
import userEvent from "@testing-library/user-event";
2020
import { mocked } from "jest-mock";
2121
import { MatrixClient, RelationType } from "matrix-js-sdk/src/matrix";
2222

@@ -48,7 +48,7 @@ describe("textForVoiceBroadcastStoppedEvent", () => {
4848
};
4949
}
5050

51-
return render(<div>{ textForVoiceBroadcastStoppedEvent(event)() }</div>);
51+
return render(<div>{textForVoiceBroadcastStoppedEvent(event)()}</div>);
5252
};
5353

5454
beforeEach(() => {

0 commit comments

Comments
 (0)