Add a few more UIComponent flags, and ensure they are used in existing code (#7937)

* UIComponent flag: Explore rooms

To disable the room directory access on the Home space. Can be controlled with the existing ComponentVisibilityCustomisation

* Make "plus menu" respect component visibility

* UIComponent flag: Add integrations

To disable the widgets section of the room info card and addwidget slashcommand. Can be controlled with the existing ComponentVisibilityCustomisation

* Make sure invite users component applies to space rooms too

* Appease the linter
This commit is contained in:
Travis Ralston 2022-03-02 10:37:18 -07:00 committed by GitHub
parent d304e24a45
commit f882466329
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 83 additions and 18 deletions

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { useCallback, useState, useEffect, useContext } from "react";
import React, { useCallback, useContext, useEffect, useState } from "react";
import classNames from "classnames";
import { Room } from "matrix-js-sdk/src/models/room";
@ -38,7 +38,7 @@ import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
import WidgetStore, { IApp } from "../../../stores/WidgetStore";
import { E2EStatus } from "../../../utils/ShieldUtils";
import RoomContext from "../../../contexts/RoomContext";
import { UIFeature } from "../../../settings/UIFeature";
import { UIComponent, UIFeature } from "../../../settings/UIFeature";
import { ChevronFace, ContextMenuTooltipButton, useContextMenu } from "../../structures/ContextMenu";
import WidgetContextMenu from "../context_menus/WidgetContextMenu";
import { useRoomMemberCount } from "../../../hooks/useRoomMembers";
@ -50,6 +50,7 @@ import UIStore from "../../../stores/UIStore";
import ExportDialog from "../dialogs/ExportDialog";
import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
import PosthogTrackers from "../../../PosthogTrackers";
import { shouldShowComponent } from "../../../customisations/helpers/UIComponents";
interface IProps {
room: Room;
@ -327,7 +328,11 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, onClose }) => {
</Button>
</Group>
{ SettingsStore.getValue(UIFeature.Widgets) && <AppsSection room={room} /> }
{
SettingsStore.getValue(UIFeature.Widgets)
&& shouldShowComponent(UIComponent.AddIntegrations)
&& <AppsSection room={room} />
}
</BaseCard>;
};