diff --git a/src/customisations/TchapComponentVisibility.ts b/src/customisations/TchapComponentVisibility.ts index 2f1a3c93cd..8a24fae9ab 100644 --- a/src/customisations/TchapComponentVisibility.ts +++ b/src/customisations/TchapComponentVisibility.ts @@ -11,6 +11,7 @@ File copied from ComponentVisibility.ts in matrix-react-sdk v3.46.0 // Populate this class with the details of your customisations when copying it. import { UIComponent } from "matrix-react-sdk/src/settings/UIFeature"; +import { MatrixClientPeg } from "matrix-react-sdk/src/MatrixClientPeg"; /** * Determines whether or not the active MatrixClient user should be able to use @@ -23,8 +24,12 @@ import { UIComponent } from "matrix-react-sdk/src/settings/UIFeature"; * otherwise. */ function shouldShowComponent(component: UIComponent): boolean { + const userId = MatrixClientPeg.get().getUserId(); + const isExternal = userId.endsWith("agent.externe.tchap.gouv.fr") || userId.endsWith("agent.e.tchap.gouv.fr"); if (component === UIComponent.CreateSpaces) { return false; + } else if (component === UIComponent.InviteUsers && isExternal) { + return false; } return true; // default to visible }