This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -15,27 +15,21 @@ limitations under the License.
15
15
*/
16
16
17
17
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 " ;
21
21
22
22
import { UIComponent } from "../../settings/UIFeature" ;
23
23
import { ComponentVisibilityCustomisations } from "../ComponentVisibility" ;
24
24
import { ModuleRunner } from "../../modules/ModuleRunner" ;
25
- import { MatrixClientPeg } from "../../MatrixClientPeg" ;
26
25
27
26
export function shouldShowComponent ( component : UIComponent ) : boolean {
28
27
let approved : boolean | undefined ;
29
28
if ( ComponentVisibilityCustomisations . shouldShowComponent ) {
30
29
approved = ComponentVisibilityCustomisations . shouldShowComponent ( component ) ;
31
30
} 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 ) ;
39
33
approved = opts . shouldShowComponent ;
40
34
}
41
35
return approved ?? true ;
Original file line number Diff line number Diff line change @@ -216,4 +216,8 @@ export class ProxiedModuleApi implements ModuleApi {
216
216
if ( ! maybeObj || ! ( typeof maybeObj === "object" ) ) return undefined ;
217
217
return maybeObj [ key ] ;
218
218
}
219
+
220
+ public getUserId ( ) : string | undefined {
221
+ return MatrixClientPeg . get ( ) ?. getUserId ( ) ?? undefined ;
222
+ }
219
223
}
You can’t perform that action at this time.
0 commit comments