Update docs
This commit is contained in:
@@ -17,7 +17,8 @@ import { type SettingLevel } from "../SettingLevel.ts";
|
|||||||
import MatrixClientBackedController from "./MatrixClientBackedController.ts";
|
import MatrixClientBackedController from "./MatrixClientBackedController.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* Handles media preview settings provided by MSC4278.
|
||||||
|
* This uses both account-level and room-level account data.
|
||||||
*/
|
*/
|
||||||
export default class MediaPreviewConfigController extends MatrixClientBackedController {
|
export default class MediaPreviewConfigController extends MatrixClientBackedController {
|
||||||
public static readonly default: AccountDataEvents["io.element.msc4278.media_preview_config"] = {
|
public static readonly default: AccountDataEvents["io.element.msc4278.media_preview_config"] = {
|
||||||
@@ -27,10 +28,6 @@ export default class MediaPreviewConfigController extends MatrixClientBackedCont
|
|||||||
|
|
||||||
private globalSetting: MediaPreviewConfig = MediaPreviewConfigController.default;
|
private globalSetting: MediaPreviewConfig = MediaPreviewConfigController.default;
|
||||||
|
|
||||||
public constructor() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
private getRoomValue = (roomId: string): MediaPreviewConfig | null => {
|
private getRoomValue = (roomId: string): MediaPreviewConfig | null => {
|
||||||
return (
|
return (
|
||||||
this.client
|
this.client
|
||||||
@@ -52,7 +49,6 @@ export default class MediaPreviewConfigController extends MatrixClientBackedCont
|
|||||||
...MediaPreviewConfigController.default,
|
...MediaPreviewConfigController.default,
|
||||||
...event.getContent(),
|
...event.getContent(),
|
||||||
};
|
};
|
||||||
console.log("CONFIG Updating global settings", this.globalSetting);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -85,7 +81,6 @@ export default class MediaPreviewConfigController extends MatrixClientBackedCont
|
|||||||
newValue: MediaPreviewConfig,
|
newValue: MediaPreviewConfig,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
if (!this.client) {
|
if (!this.client) {
|
||||||
// No client!
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (roomId) {
|
if (roomId) {
|
||||||
@@ -97,8 +92,4 @@ export default class MediaPreviewConfigController extends MatrixClientBackedCont
|
|||||||
await this.client.setAccountData(MEDIA_PREVIEW_ACCOUNT_DATA_TYPE, newValue);
|
await this.client.setAccountData(MEDIA_PREVIEW_ACCOUNT_DATA_TYPE, newValue);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public onChange(_level: SettingLevel, roomId: string | null, newValue: MediaPreviewConfig): void {
|
|
||||||
console.log("onChange", roomId, newValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user