Show "Invite" menu option if "UIComponent.sendInvites" is enabled. (#10363)

* Show "Invite" menu option if "UIComponent.sendInvites" is enabled.

Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>

* Update test names

Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>

---------

Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
Co-authored-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
This commit is contained in:
maheichyk 2023-03-27 23:10:18 +03:00 committed by GitHub
parent d821323e5c
commit 68fa9aed9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 121 additions and 3 deletions

View file

@ -38,6 +38,8 @@ import IconizedContextMenu, {
IconizedContextMenuOptionList,
} from "../context_menus/IconizedContextMenu";
import { ButtonEvent } from "../elements/AccessibleButton";
import { shouldShowComponent } from "../../../customisations/helpers/UIComponents";
import { UIComponent } from "../../../settings/UIFeature";
export interface RoomGeneralContextMenuProps extends IContextMenuProps {
room: Room;
@ -119,7 +121,7 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
);
let inviteOption: JSX.Element | null = null;
if (room.canInvite(cli.getUserId()!) && !isDm) {
if (room.canInvite(cli.getUserId()!) && !isDm && shouldShowComponent(UIComponent.InviteUsers)) {
inviteOption = (
<IconizedContextMenuOption
onClick={wrapHandler(