diff --git a/apps/meteor/client/providers/LayoutProvider.tsx b/apps/meteor/client/providers/LayoutProvider.tsx index 47906ead3e33..026b96c971ee 100644 --- a/apps/meteor/client/providers/LayoutProvider.tsx +++ b/apps/meteor/client/providers/LayoutProvider.tsx @@ -48,6 +48,18 @@ const messageToolbox = [ const composerToolbox = ['video-message' /* 'audio-message' */, 'file-upload', /* 'create-discussion', */ 'webdav-add', 'share-location']; +const userToolbox = [ + 'openDirectMessage', + 'changeOwner', + 'changeLeader', + 'changeModerator', + 'openModerationConsole', + 'ignoreUser', + 'muteUser', + 'reportUser', + 'removeUser', +]; + const LayoutProvider: FC = ({ children }) => { const showTopNavbarEmbeddedLayout = Boolean(useSetting('UI_Show_top_navbar_embedded_layout')); const [isCollapsed, setIsCollapsed] = useState(false); @@ -91,6 +103,7 @@ const LayoutProvider: FC = ({ children }) => { roomToolbox, messageToolbox, composerToolbox, + userToolbox, }, }), [isMobile, isEmbedded, showTopNavbarEmbeddedLayout, isCollapsed, breakpoints, router], diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/useUserInfoActions.ts b/apps/meteor/client/views/room/hooks/useUserInfoActions/useUserInfoActions.ts index dfe9c0341e00..a058fb862ad5 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/useUserInfoActions.ts +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/useUserInfoActions.ts @@ -1,5 +1,6 @@ import type { IRoom, IUser } from '@rocket.chat/core-typings'; import type { Icon } from '@rocket.chat/fuselage'; +import { useLayoutHiddenActions } from '@rocket.chat/ui-contexts'; import type { ComponentProps } from 'react'; import { useMemo } from 'react'; @@ -51,6 +52,7 @@ export const useUserInfoActions = ( const call = useCallAction(user); const reportUserOption = useReportUser(user); const isLayoutEmbedded = useEmbeddedLayout(); + const { userToolbox: hiddenActions } = useLayoutHiddenActions(); const userinfoActions = useMemo( () => ({ @@ -83,7 +85,7 @@ export const useUserInfoActions = ( ); const actionSpread = useMemo(() => { - const entries = Object.entries(userinfoActions); + const entries = Object.entries(userinfoActions).filter(([key]) => !hiddenActions.includes(key)); const options = entries.slice(0, size); const slicedOptions = entries.slice(size, entries.length); @@ -105,7 +107,7 @@ export const useUserInfoActions = ( }, [] as UserMenuAction); return { actions: options, menuActions }; - }, [size, userinfoActions]); + }, [size, userinfoActions, hiddenActions]); return actionSpread; }; diff --git a/packages/ui-contexts/src/LayoutContext.ts b/packages/ui-contexts/src/LayoutContext.ts index 6d6849d2a96d..2d900b5a7612 100644 --- a/packages/ui-contexts/src/LayoutContext.ts +++ b/packages/ui-contexts/src/LayoutContext.ts @@ -24,6 +24,7 @@ export type LayoutContextValue = { roomToolbox: Array; messageToolbox: Array; composerToolbox: Array; + userToolbox: Array; }; }; @@ -49,5 +50,6 @@ export const LayoutContext = createContext({ roomToolbox: [], messageToolbox: [], composerToolbox: [], + userToolbox: [], }, });