diff --git a/src/HtmlUtils.tsx b/src/HtmlUtils.tsx
index abc7c74c12..bb48c6b843 100644
--- a/src/HtmlUtils.tsx
+++ b/src/HtmlUtils.tsx
@@ -294,6 +294,9 @@ export interface EventRenderOpts {
disableBigEmoji?: boolean;
stripReplyFallback?: boolean;
forComposerQuote?: boolean;
+ /**
+ * Should inline media be rendered?
+ */
mediaIsVisible?: boolean;
}
diff --git a/src/hooks/room/useJoinRule.ts b/src/hooks/room/useJoinRule.ts
deleted file mode 100644
index 3e66f3beeb..0000000000
--- a/src/hooks/room/useJoinRule.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-Copyright 2025 New Vector Ltd.
-
-SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
-Please see LICENSE files in the repository root for full details.
-*/
-
-import { useEffect, useState } from "react";
-import { EventType, type MatrixEvent, type Room, RoomStateEvent, type JoinRule } from "matrix-js-sdk/src/matrix";
-
-import { useTypedEventEmitter } from "../useEventEmitter";
-
-/**
- * Helper to retrieve the join rules for given room
- * @param room
- * @returns the current join rule
- */
-
-export function useJoinRule(room?: Room): JoinRule | undefined {
- const [joinRule, setJoinRule] = useState(room?.getJoinRule());
- useTypedEventEmitter(room?.currentState, RoomStateEvent.Events, (ev: MatrixEvent) => {
- if (ev.getType() !== EventType.RoomJoinRules) return;
- setJoinRule(room?.getJoinRule());
- });
- useEffect(() => {
- setJoinRule(room?.getJoinRule());
- }, [room]);
-
- return joinRule;
-}
diff --git a/src/hooks/room/useRoomAvatar.ts b/src/hooks/room/useRoomAvatar.ts
deleted file mode 100644
index 850f699739..0000000000
--- a/src/hooks/room/useRoomAvatar.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-Copyright 2025 New Vector Ltd.
-
-SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
-Please see LICENSE files in the repository root for full details.
-*/
-
-import { useEffect, useState } from "react";
-import { EventType, type MatrixEvent, type Room, RoomStateEvent } from "matrix-js-sdk/src/matrix";
-
-import { useTypedEventEmitter } from "../useEventEmitter";
-
-/**
- * Helper to retrieve the avatar for given room
- * @param room
- * @returns the current avatar
- */
-export function useRoomAvatar(room?: Room): string | undefined {
- const [avatarMxc, setAvatar] = useState(room?.getMxcAvatarUrl() ?? undefined);
- useTypedEventEmitter(room?.currentState, RoomStateEvent.Events, (ev: MatrixEvent) => {
- if (ev.getType() !== EventType.RoomAvatar) return;
- setAvatar(room?.getMxcAvatarUrl() ?? undefined);
- });
- useEffect(() => {
- setAvatar(room?.getMxcAvatarUrl() ?? undefined);
- }, [room]);
-
- return avatarMxc;
-}
diff --git a/src/hooks/useMediaVisible.ts b/src/hooks/useMediaVisible.ts
index f7f5e487af..f367e87c4f 100644
--- a/src/hooks/useMediaVisible.ts
+++ b/src/hooks/useMediaVisible.ts
@@ -13,7 +13,7 @@ import { useSettingValue } from "./useSettings";
import SettingsStore from "../settings/SettingsStore";
import { useMatrixClientContext } from "../contexts/MatrixClientContext";
import { MediaPreviewValue } from "../@types/media_preview";
-import { useJoinRule } from "./room/useJoinRule";
+import { useRoomState } from "./useRoomState";
const PRIVATE_JOIN_RULES: JoinRule[] = [JoinRule.Invite, JoinRule.Knock, JoinRule.Restricted];
@@ -26,7 +26,7 @@ export function useMediaVisible(eventId?: string, roomId?: string): [boolean, (v
const mediaPreviewSetting = useSettingValue("mediaPreviewConfig", roomId);
const client = useMatrixClientContext();
const eventVisibility = useSettingValue("showMediaEventIds");
- const joinRule = useJoinRule(client?.getRoom(roomId) ?? undefined);
+ const joinRule = useRoomState(client.getRoom(roomId) ?? undefined, (state) => state.getJoinRule());
const setMediaVisible = useCallback(
(visible: boolean) => {
SettingsStore.setValue("showMediaEventIds", null, SettingLevel.DEVICE, {
diff --git a/src/settings/controllers/MatrixClientBackedController.ts b/src/settings/controllers/MatrixClientBackedController.ts
index 2c72dd3606..b305ad5fa2 100644
--- a/src/settings/controllers/MatrixClientBackedController.ts
+++ b/src/settings/controllers/MatrixClientBackedController.ts
@@ -40,5 +40,5 @@ export default abstract class MatrixClientBackedController extends SettingContro
return MatrixClientBackedController._matrixClient;
}
- protected initMatrixClient?(newClient: MatrixClient, oldClient?: MatrixClient): Promise;
+ protected initMatrixClient?(newClient: MatrixClient, oldClient?: MatrixClient): void;
}