Fix Prettier errors that slipped past CI (#9741)

This commit is contained in:
Faye Duxovni 2022-12-12 17:43:29 -05:00 committed by GitHub
parent d835721ae1
commit 43f175892a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 23 deletions

View file

@ -31,7 +31,7 @@ import defaultDispatcher from "../dispatcher/dispatcher";
import { TimelineRenderingType } from "../contexts/RoomContext"; import { TimelineRenderingType } from "../contexts/RoomContext";
import { launchPollEditor } from "../components/views/messages/MPollBody"; import { launchPollEditor } from "../components/views/messages/MPollBody";
import { Action } from "../dispatcher/actions"; 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. * Returns whether an event should allow actions like reply, reactions, edit, etc.

View file

@ -18,8 +18,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/matrix";
import { VoiceBroadcastInfoEventType, VoiceBroadcastInfoState } from ".."; import { VoiceBroadcastInfoEventType, VoiceBroadcastInfoState } from "..";
export const shouldDisplayAsVoiceBroadcastStoppedText = (event: MatrixEvent): boolean => ( export const shouldDisplayAsVoiceBroadcastStoppedText = (event: MatrixEvent): boolean =>
event.getType() === VoiceBroadcastInfoEventType event.getType() === VoiceBroadcastInfoEventType &&
&& event.getContent()?.state === VoiceBroadcastInfoState.Stopped event.getContent()?.state === VoiceBroadcastInfoState.Stopped &&
&& !event.isRedacted() !event.isRedacted();
);

View file

@ -23,33 +23,27 @@ import { highlightEvent } from "../../utils/EventUtils";
import { getSenderName } from "../../TextForEvent"; import { getSenderName } from "../../TextForEvent";
import { _t } from "../../languageHandler"; import { _t } from "../../languageHandler";
export const textForVoiceBroadcastStoppedEvent = (event: MatrixEvent): () => ReactNode => { export const textForVoiceBroadcastStoppedEvent = (event: MatrixEvent): (() => ReactNode) => {
return (): ReactNode => { return (): ReactNode => {
const ownUserId = MatrixClientPeg.get()?.getUserId(); const ownUserId = MatrixClientPeg.get()?.getUserId();
const startEventId = event.getRelation()?.event_id; const startEventId = event.getRelation()?.event_id;
const roomId = event.getRoomId(); const roomId = event.getRoomId();
const templateTags = { const templateTags = {
a: (text: string) => startEventId && roomId a: (text: string) =>
? ( startEventId && roomId ? (
<AccessibleButton <AccessibleButton kind="link_inline" onClick={() => highlightEvent(roomId, startEventId)}>
kind="link_inline" {text}
onClick={() => highlightEvent(roomId, startEventId)}
>
{ text }
</AccessibleButton> </AccessibleButton>
) ) : (
: text, text
),
}; };
if (ownUserId && ownUserId === event.getSender()) { if (ownUserId && ownUserId === event.getSender()) {
return _t("You ended a <a>voice broadcast</a>", {}, templateTags); return _t("You ended a <a>voice broadcast</a>", {}, templateTags);
} }
return _t( return _t("%(senderName)s ended a <a>voice broadcast</a>", { senderName: getSenderName(event) }, templateTags);
"%(senderName)s ended a <a>voice broadcast</a>",
{ senderName: getSenderName(event) },
templateTags,
);
}; };
}; };

View file

@ -16,7 +16,7 @@ limitations under the License.
import React from "react"; import React from "react";
import { render, RenderResult, screen } from "@testing-library/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 { mocked } from "jest-mock";
import { MatrixClient, RelationType } from "matrix-js-sdk/src/matrix"; import { MatrixClient, RelationType } from "matrix-js-sdk/src/matrix";
@ -48,7 +48,7 @@ describe("textForVoiceBroadcastStoppedEvent", () => {
}; };
} }
return render(<div>{ textForVoiceBroadcastStoppedEvent(event)() }</div>); return render(<div>{textForVoiceBroadcastStoppedEvent(event)()}</div>);
}; };
beforeEach(() => { beforeEach(() => {