Fix Prettier errors that slipped past CI (#9741)
This commit is contained in:
parent
d835721ae1
commit
43f175892a
4 changed files with 16 additions and 23 deletions
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
? (
|
||||
<AccessibleButton
|
||||
kind="link_inline"
|
||||
onClick={() => highlightEvent(roomId, startEventId)}
|
||||
>
|
||||
{ text }
|
||||
a: (text: string) =>
|
||||
startEventId && roomId ? (
|
||||
<AccessibleButton kind="link_inline" onClick={() => highlightEvent(roomId, startEventId)}>
|
||||
{text}
|
||||
</AccessibleButton>
|
||||
)
|
||||
: text,
|
||||
) : (
|
||||
text
|
||||
),
|
||||
};
|
||||
|
||||
if (ownUserId && ownUserId === event.getSender()) {
|
||||
return _t("You ended a <a>voice broadcast</a>", {}, templateTags);
|
||||
}
|
||||
|
||||
return _t(
|
||||
"%(senderName)s ended a <a>voice broadcast</a>",
|
||||
{ senderName: getSenderName(event) },
|
||||
templateTags,
|
||||
);
|
||||
return _t("%(senderName)s ended a <a>voice broadcast</a>", { senderName: getSenderName(event) }, templateTags);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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(<div>{ textForVoiceBroadcastStoppedEvent(event)() }</div>);
|
||||
return render(<div>{textForVoiceBroadcastStoppedEvent(event)()}</div>);
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
Loading…
Reference in a new issue