Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit e3fd624

Browse files
committed
Update to fit into changes from module branch
Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
1 parent 4b68828 commit e3fd624

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/customisations/helpers/UIComponents.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,21 @@ limitations under the License.
1515
*/
1616

1717
import {
18-
ShouldShowUiComponentOps,
19-
UiComponentLifecycle,
20-
} from "@matrix-org/react-sdk-module-api/lib/lifecycles/UiComponentLifecycle";
18+
ShouldShowUIComponentOps,
19+
UIComponentLifecycle,
20+
} from "@matrix-org/react-sdk-module-api/lib/lifecycles/UIComponentLifecycle";
2121

2222
import { UIComponent } from "../../settings/UIFeature";
2323
import { ComponentVisibilityCustomisations } from "../ComponentVisibility";
2424
import { ModuleRunner } from "../../modules/ModuleRunner";
25-
import { MatrixClientPeg } from "../../MatrixClientPeg";
2625

2726
export function shouldShowComponent(component: UIComponent): boolean {
2827
let approved: boolean | undefined;
2928
if (ComponentVisibilityCustomisations.shouldShowComponent) {
3029
approved = ComponentVisibilityCustomisations.shouldShowComponent(component);
3130
} else {
32-
const opts: ShouldShowUiComponentOps = { shouldShowComponent: undefined };
33-
ModuleRunner.instance.invoke(
34-
UiComponentLifecycle.ShouldShowComponent,
35-
opts,
36-
component,
37-
MatrixClientPeg.get().getUserId(),
38-
);
31+
const opts: ShouldShowUIComponentOps = { shouldShowComponent: undefined };
32+
ModuleRunner.instance.invoke(UIComponentLifecycle.ShouldShowComponent, opts, component);
3933
approved = opts.shouldShowComponent;
4034
}
4135
return approved ?? true;

src/modules/ProxiedModuleApi.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,8 @@ export class ProxiedModuleApi implements ModuleApi {
216216
if (!maybeObj || !(typeof maybeObj === "object")) return undefined;
217217
return maybeObj[key];
218218
}
219+
220+
public getUserId(): string | undefined {
221+
return MatrixClientPeg.get()?.getUserId() ?? undefined;
222+
}
219223
}

0 commit comments

Comments
 (0)