Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-boats-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Removes deprecated search federated rooms
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@ import { useAtLeastOnePermission } from '@rocket.chat/ui-contexts';
import { useTranslation } from 'react-i18next';

import { useCreateNewItems } from './useCreateNewItems';
import { useMatrixFederationItems } from './useMatrixFederationItems';
import { useIsEnterprise } from '../../../hooks/useIsEnterprise';
import { useIsFederationEnabled } from '../../../hooks/useIsFederationEnabled';

const CREATE_ROOM_PERMISSIONS = ['create-c', 'create-p', 'create-d', 'start-discussion', 'start-discussion-other-user'];

export const useCreateNewMenu = () => {
const { t } = useTranslation();
const showCreate = useAtLeastOnePermission(CREATE_ROOM_PERMISSIONS);

const { data } = useIsEnterprise();
const isMatrixEnabled = useIsFederationEnabled() && data?.isEnterprise;

const createRoomItems = useCreateNewItems();
const matrixFederationSearchItems = useMatrixFederationItems({ isMatrixEnabled });

const sections = [
{ title: t('Create_new'), items: createRoomItems, permission: showCreate },
{ title: t('Explore'), items: matrixFederationSearchItems, permission: showCreate && isMatrixEnabled },
];
const sections = [{ title: t('Create_new'), items: createRoomItems, permission: showCreate }];

return sections.filter((section) => section.permission);
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@ import { useAtLeastOnePermission } from '@rocket.chat/ui-contexts';
import { useTranslation } from 'react-i18next';

import { useCreateRoomItems } from './useCreateRoomItems';
import { useMatrixFederationItems } from './useMatrixFederationItems';
import { useIsEnterprise } from '../../../../hooks/useIsEnterprise';
import { useIsFederationEnabled } from '../../../../hooks/useIsFederationEnabled';

const CREATE_ROOM_PERMISSIONS = ['create-c', 'create-p', 'create-d', 'start-discussion', 'start-discussion-other-user'];

export const useCreateRoom = () => {
const { t } = useTranslation();
const showCreate = useAtLeastOnePermission(CREATE_ROOM_PERMISSIONS);

const { data } = useIsEnterprise();
const isMatrixEnabled = useIsFederationEnabled() && data?.isEnterprise;

const createRoomItems = useCreateRoomItems();
const matrixFederationSearchItems = useMatrixFederationItems({ isMatrixEnabled });

const sections = [
{ title: t('Create_new'), items: createRoomItems, permission: showCreate },
{ title: t('Explore'), items: matrixFederationSearchItems, permission: showCreate && isMatrixEnabled },
];
const sections = [{ title: t('Create_new'), items: createRoomItems, permission: showCreate }];

return sections.filter((section) => section.permission);
};
Comment on lines +14 to 17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

🧩 Analysis chain

LGTM — menu now only shows valid “Create new” actions.

Matches the goal to remove the federated search entry.

Quick check for leftovers:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C2 --type=ts --type=tsx -S \
  -e 'useMatrixFederationItems' \
  -e 'useIsFederationEnabled' \
  -e '\bisMatrixEnabled\b' \
  -e 'Search[_ ]federated[_ ]rooms' \
  apps/meteor || true

Length of output: 27


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== show file (if exists) =="
sed -n '1,240p' apps/meteor/client/sidebar/header/actions/hooks/useCreateRoomMenu.tsx || true

echo
echo "== search for federation-related symbols =="
rg -n -C2 -S \
  -e 'useMatrixFederationItems' \
  -e 'useIsFederationEnabled' \
  -e '\bisMatrixEnabled\b' \
  -e 'Search[_ ]federated[_ ]rooms' \
  apps/meteor || true

echo
echo "== broader search for 'federat' occurrences =="
rg -n -C2 -S 'federat' apps/meteor || true

Length of output: 302103


LGTM — Create menu now filters correctly; leftover federated search items remain

useCreateRoomMenu.tsx correctly filters the Create_new section by permission. The Matrix federation search item still exists in:

  • apps/meteor/client/sidebar/header/actions/hooks/useMatrixFederationItems.ts
  • apps/meteor/client/NavBarV2/NavBarPagesGroup/hooks/useMatrixFederationItems.ts

Remove or gate those if the intent was to remove the federated search entry globally.

🤖 Prompt for AI Agents
In apps/meteor/client/sidebar/header/actions/hooks/useCreateRoomMenu.tsx lines
14-17 you correctly filter the Create_new section by permission, but federated
search menu items still appear elsewhere; update
apps/meteor/client/sidebar/header/actions/hooks/useMatrixFederationItems.ts and
apps/meteor/client/NavBarV2/NavBarPagesGroup/hooks/useMatrixFederationItems.ts
to either remove the Matrix federation search item or gate it behind the same
permission check used for Create_new (add a permission prop/flag, return [] when
not allowed), ensuring these hooks return no items when the user lacks the
permission so the federated search entry is removed globally.

Loading