Eliminate the use of MatrixClientPeg in utils (#10910)
This commit is contained in:
parent
a0c2676c38
commit
30429df948
108 changed files with 409 additions and 325 deletions
|
@ -18,11 +18,10 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
|||
import { EventType, MsgType } from "matrix-js-sdk/src/@types/event";
|
||||
import { M_POLL_END, M_POLL_START } from "matrix-js-sdk/src/@types/polls";
|
||||
import { M_BEACON_INFO } from "matrix-js-sdk/src/@types/beacon";
|
||||
import { IContent } from "matrix-js-sdk/src/matrix";
|
||||
import { IContent, MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
import { haveRendererForEvent, JitsiEventFactory, JSONEventFactory, pickFactory } from "../events/EventTileFactory";
|
||||
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||
import { getMessageModerationState, isLocationEvent, MessageModerationState } from "./EventUtils";
|
||||
import { ElementCall } from "../models/Call";
|
||||
import { VoiceBroadcastInfoEventType, VoiceBroadcastInfoState } from "../voice-broadcast";
|
||||
|
@ -48,6 +47,7 @@ const calcIsInfoMessage = (
|
|||
};
|
||||
|
||||
export function getEventDisplayInfo(
|
||||
matrixClient: MatrixClient,
|
||||
mxEvent: MatrixEvent,
|
||||
showHiddenEvents: boolean,
|
||||
hideEvent?: boolean,
|
||||
|
@ -65,7 +65,7 @@ export function getEventDisplayInfo(
|
|||
|
||||
let isSeeingThroughMessageHiddenForModeration = false;
|
||||
if (SettingsStore.getValue("feature_msc3531_hide_messages_pending_moderation")) {
|
||||
switch (getMessageModerationState(mxEvent)) {
|
||||
switch (getMessageModerationState(mxEvent, matrixClient)) {
|
||||
case MessageModerationState.VISIBLE_FOR_ALL:
|
||||
case MessageModerationState.HIDDEN_TO_CURRENT_USER:
|
||||
// Nothing specific to do here
|
||||
|
@ -77,8 +77,7 @@ export function getEventDisplayInfo(
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Thread a MatrixClient through to here
|
||||
let factory = pickFactory(mxEvent, MatrixClientPeg.get(), showHiddenEvents);
|
||||
let factory = pickFactory(mxEvent, matrixClient, showHiddenEvents);
|
||||
|
||||
// Info messages are basically information about commands processed on a room
|
||||
let isBubbleMessage =
|
||||
|
@ -103,10 +102,8 @@ export function getEventDisplayInfo(
|
|||
// replace relations (which otherwise would display as a confusing
|
||||
// duplicate of the thing they are replacing).
|
||||
if (hideEvent || !haveRendererForEvent(mxEvent, showHiddenEvents)) {
|
||||
// forcefully ask for a factory for a hidden event (hidden event
|
||||
// setting is checked internally)
|
||||
// TODO: Thread a MatrixClient through to here
|
||||
factory = pickFactory(mxEvent, MatrixClientPeg.get(), showHiddenEvents, true);
|
||||
// forcefully ask for a factory for a hidden event (hidden event setting is checked internally)
|
||||
factory = pickFactory(mxEvent, matrixClient, showHiddenEvents, true);
|
||||
if (factory === JSONEventFactory) {
|
||||
isBubbleMessage = false;
|
||||
// Reuse info message avatar and sender profile styling
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue