From b554a33b7f2ad02990e06dd7ef0c17a679783bac Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Tue, 11 Nov 2025 16:14:01 -0300 Subject: [PATCH 01/11] chore: ABAC Attributes room info view --- .../ABAC/RoomInfoABACSection.spec.tsx | 79 +++++++++++++ .../RoomInfo/ABAC/RoomInfoABACSection.tsx | 62 +++++++++++ .../RoomInfoABACSection.spec.tsx.snap | 105 ++++++++++++++++++ .../Info/RoomInfo/RoomInfo.stories.tsx | 23 +++- .../contextualBar/Info/RoomInfo/RoomInfo.tsx | 3 + packages/i18n/src/locales/en.i18n.json | 3 + 6 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx create mode 100644 apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx create mode 100644 apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx new file mode 100644 index 0000000000000..2b975380407ca --- /dev/null +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx @@ -0,0 +1,79 @@ +import type { IRoom } from '@rocket.chat/core-typings'; +import { mockAppRoot } from '@rocket.chat/mock-providers'; +import { render, screen } from '@testing-library/react'; +import { axe } from 'jest-axe'; + +import RoomInfoABACSection from './RoomInfoABACSection'; +import { createFakeRoom } from '../../../../../../../tests/mocks/data'; + +type RoomWithABAC = IRoom & { + abacAttributes: { + name: string; + values: string[]; + }[]; +}; + +describe('RoomInfoABACSection', () => { + const createRoomWithABAC = (attributes: { name: string; values: string[] }[]): RoomWithABAC => { + const room = createFakeRoom(); + return { + ...room, + abacAttributes: attributes, + } as RoomWithABAC; + }; + + const appRootWithABACEnabled = mockAppRoot().withSetting('ABAC_Enabled', true).withSetting('ABAC_ShowAttributesInRooms', true).build(); + + describe('Conditional rendering', () => { + it('should return null when ABAC_Enabled is false', () => { + const room = createRoomWithABAC([{ name: 'Test', values: ['Value1'] }]); + const appRoot = mockAppRoot().withSetting('ABAC_Enabled', false).withSetting('ABAC_ShowAttributesInRooms', true).build(); + + render(, { wrapper: appRoot }); + expect(screen.queryByText('ABAC_Managed')).not.toBeInTheDocument(); + }); + + it('should return null when ABAC_ShowAttributesInRooms is false', () => { + const room = createRoomWithABAC([{ name: 'Test', values: ['Value1'] }]); + const appRoot = mockAppRoot().withSetting('ABAC_Enabled', true).withSetting('ABAC_ShowAttributesInRooms', false).build(); + + render(, { wrapper: appRoot }); + expect(screen.queryByText('ABAC_Managed')).not.toBeInTheDocument(); + }); + + it('should return null when abacAttributes is empty', () => { + const room = createRoomWithABAC([]); + render(, { wrapper: appRootWithABACEnabled }); + expect(screen.queryByText('ABAC_Managed')).not.toBeInTheDocument(); + }); + + it('should render when all conditions are met', () => { + const room = createRoomWithABAC([{ name: 'Test', values: ['Value1'] }]); + render(, { wrapper: appRootWithABACEnabled }); + expect(screen.getByText('ABAC_Managed')).toBeInTheDocument(); + }); + }); + + describe('Accessibility', () => { + it('should have no accessibility violations', async () => { + const room = createRoomWithABAC([ + { name: 'Chat-sensitivity', values: ['Classified', 'Top-Secret'] }, + { name: 'Country', values: ['US-only'] }, + ]); + const { container } = render(, { wrapper: appRootWithABACEnabled }); + + const results = await axe(container); + expect(results).toHaveNoViolations(); + }); + }); + describe('Snapshot', () => { + it('should match the snapshot', () => { + const room = createRoomWithABAC([ + { name: 'Chat-sensitivity', values: ['Classified', 'Top-Secret'] }, + { name: 'Country', values: ['US-only'] }, + ]); + const { baseElement } = render(, { wrapper: appRootWithABACEnabled }); + expect(baseElement).toMatchSnapshot(); + }); + }); +}); diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx new file mode 100644 index 0000000000000..91eb6ad4d0279 --- /dev/null +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx @@ -0,0 +1,62 @@ +import type { IRoom } from '@rocket.chat/core-typings'; +import { Box, Divider, Tag } from '@rocket.chat/fuselage'; +import { useSetting } from '@rocket.chat/ui-contexts'; +import { useTranslation } from 'react-i18next'; + +import { InfoPanelField, InfoPanelLabel } from '../../../../../../components/InfoPanel'; +import { RoomIcon } from '../../../../../../components/RoomIcon'; + +// TODO: Remove type union when ABAC is implemented +type RoomInfoABACSectionProps = { + room: IRoom & { + abacAttributes: { + name: string; + values: string[]; + }[]; + }; +}; + +const RoomInfoABACSection = ({ room }: RoomInfoABACSectionProps) => { + const { t } = useTranslation(); + + const abacEnabled = useSetting('ABAC_Enabled'); + const showAttributesInRoom = useSetting('ABAC_ShowAttributesInRooms'); + + if (!abacEnabled || !showAttributesInRoom || !room.abacAttributes || room.abacAttributes.length === 0) { + return null; + } + + return ( + <> + + + + + + + {t('ABAC_Managed')} + + + + + {t('ABAC_Managed_description')} + + {t('ABAC_Room_Attributes')} + {room.abacAttributes.map((attribute) => ( + + {attribute.name} + + {attribute.values.map((value) => ( + + {value} + + ))} + + + ))} + + + ); +}; + +export default RoomInfoABACSection; diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap new file mode 100644 index 0000000000000..dfc788d29e086 --- /dev/null +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap @@ -0,0 +1,105 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`RoomInfoABACSection Snapshot should match the snapshot 1`] = ` + +
+
+
+
+ + +
+ +
+ ABAC_Managed +
+
+
+
+
+ ABAC_Managed_description +
+ ABAC_Room_Attributes +
+
+ Chat-sensitivity +
+
+ + + Classified + + +
+
+ + + Top-Secret + + +
+
+
+
+ Country +
+
+ + + US-only + + +
+
+
+
+
+ +`; diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.stories.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.stories.tsx index 3feb078e0c68e..9c31f290cb067 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.stories.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.stories.tsx @@ -2,6 +2,7 @@ import type { RoomType } from '@rocket.chat/core-typings'; import type { Meta, StoryFn } from '@storybook/react'; import RoomInfo from './RoomInfo'; +import FakeRoomProvider from '../../../../../../tests/mocks/client/FakeRoomProvider'; import { Contextualbar } from '../../../../../components/Contextualbar'; export default { @@ -10,7 +11,13 @@ export default { layout: 'fullscreen', actions: { argTypesRegex: '^on[A-Z].*' }, }, - decorators: [(fn) => {fn()}], + decorators: [ + (fn) => ( + + {fn()} + + ), + ], args: { icon: 'lock', }, @@ -61,3 +68,17 @@ Broadcast.args = { broadcast: true, }, }; + +export const ABAC = Template.bind({}); +ABAC.args = { + ...Default.args, + room: { + ...roomArgs, + // @ts-expect-error - abacAttributes is not yet implemented in Rooms properties + abacAttributes: [ + { name: 'Chat-sensitivity', values: ['Classified', 'Top-Secret'] }, + { name: 'Country', values: ['US-only'] }, + { name: 'Project', values: ['Ruminator-2000'] }, + ], + }, +}; diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx index ffb0ef73ebdb5..7b85574a14a3d 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx @@ -29,6 +29,7 @@ import MarkdownText from '../../../../../components/MarkdownText'; import { useRetentionPolicy } from '../../../hooks/useRetentionPolicy'; import { useRoomActions } from '../hooks/useRoomActions'; import { useSplitRoomActions } from '../hooks/useSplitRoomActions'; +import RoomInfoABACSection from './ABAC/RoomInfoABACSection'; type RoomInfoProps = { room: IRoom; @@ -128,6 +129,8 @@ const RoomInfo = ({ room, icon, onClickBack, onClickClose, onClickEnterRoom, onC )} {retentionPolicy?.isActive && } + {/* @ts-expect-error - abacAttributes is not yet implemented in Rooms properties */} + {room.abacAttributes !== undefined && room.abacAttributes.length > 0 && } diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index 31cb799e22568..c0b4df149124a 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -77,6 +77,9 @@ "A_new_owner_will_be_assigned_automatically_to_those__count__rooms__rooms__": "A new owner will be assigned automatically to those {{count}} rooms:
{{rooms}}.", "A_secure_and_highly_private_self-managed_solution_for_conference_calls": "A secure and highly private self-managed solution for conference calls.", "A_workspace_admin_needs_to_install_and_configure_a_conference_call_app": "A workspace admin needs to install and configure a conference call app.", + "ABAC_Managed": "ABAC Managed", + "ABAC_Managed_description": "Only compliant users have access to attribute-based access controlled rooms. Attributes determine room access.", + "ABAC_Room_Attributes": "Room Attributes", "Accept": "Accept", "Accept_Call": "Accept Call", "Accept_incoming_livechat_requests_even_if_there_are_no_online_agents": "Accept incoming omnichannel requests even if there are no online agents", From 0f2054948f1347e2f0f81ee8390b9a31efdfa7ae Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Wed, 12 Nov 2025 13:34:57 -0300 Subject: [PATCH 02/11] chore: snapshot --- .../ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap index dfc788d29e086..9cfc99a0dfb70 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap @@ -23,10 +23,8 @@ exports[`RoomInfoABACSection Snapshot should match the snapshot 1`] = ` > + class="rcx-box rcx-box--full rcx-icon--name-hash-shield rcx-icon rcx-css-1g87xs3" + />
From d738f360d29c0828ec70c52276a4bdb83e7ef14d Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Thu, 13 Nov 2025 13:21:25 -0300 Subject: [PATCH 03/11] snapshot --- .../ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap index 9cfc99a0dfb70..d5c6993d086e7 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap @@ -24,7 +24,9 @@ exports[`RoomInfoABACSection Snapshot should match the snapshot 1`] = `
From 9158479b27ee915a0f34ea0745b065badf3f542f Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Fri, 14 Nov 2025 14:33:33 -0300 Subject: [PATCH 04/11] review: Fix reviews --- .../RoomInfo/ABAC/RoomInfoABACSection.tsx | 28 +++++++++++-------- .../Info/RoomInfo/RoomInfo.stories.tsx | 9 ++++++ .../contextualBar/Info/RoomInfo/RoomInfo.tsx | 2 +- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx index 91eb6ad4d0279..9a6742187f87a 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx @@ -41,19 +41,23 @@ const RoomInfoABACSection = ({ room }: RoomInfoABACSectionProps) => { {t('ABAC_Managed_description')} - {t('ABAC_Room_Attributes')} - {room.abacAttributes.map((attribute) => ( - - {attribute.name} - - {attribute.values.map((value) => ( - - {value} - - ))} + {t('ABAC_Room_Attributes')} + + {room.abacAttributes.map((attribute) => ( + + + {attribute.name} + + + {attribute.values.map((value) => ( + + {value} + + ))} + - - ))} + ))} + ); diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.stories.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.stories.tsx index 9c31f290cb067..03a8e0a71447f 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.stories.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.stories.tsx @@ -1,4 +1,5 @@ import type { RoomType } from '@rocket.chat/core-typings'; +import { mockAppRoot } from '@rocket.chat/mock-providers'; import type { Meta, StoryFn } from '@storybook/react'; import RoomInfo from './RoomInfo'; @@ -70,6 +71,14 @@ Broadcast.args = { }; export const ABAC = Template.bind({}); +ABAC.decorators = [ + mockAppRoot().withSetting('ABAC_Enabled', true).withSetting('ABAC_ShowAttributesInRooms', true).buildStoryDecorator(), + (fn) => ( + + {fn()} + + ), +]; ABAC.args = { ...Default.args, room: { diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx index 7b85574a14a3d..db7f96199c58d 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx @@ -130,7 +130,7 @@ const RoomInfo = ({ room, icon, onClickBack, onClickClose, onClickEnterRoom, onC {retentionPolicy?.isActive && } {/* @ts-expect-error - abacAttributes is not yet implemented in Rooms properties */} - {room.abacAttributes !== undefined && room.abacAttributes.length > 0 && } + From 8bf14ffd6b034a59ecb580d9729c040c13bc7fbe Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Fri, 14 Nov 2025 14:36:01 -0300 Subject: [PATCH 05/11] review: fix condition --- .../contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx index 9a6742187f87a..1fc722fbf3110 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx @@ -22,7 +22,7 @@ const RoomInfoABACSection = ({ room }: RoomInfoABACSectionProps) => { const abacEnabled = useSetting('ABAC_Enabled'); const showAttributesInRoom = useSetting('ABAC_ShowAttributesInRooms'); - if (!abacEnabled || !showAttributesInRoom || !room.abacAttributes || room.abacAttributes.length === 0) { + if (!abacEnabled || !showAttributesInRoom || room.abacAttributes?.length === 0) { return null; } From 7ef630503789b2df2ac7dbde47092e307d7a0119 Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Fri, 14 Nov 2025 14:38:28 -0300 Subject: [PATCH 06/11] chore: oh snap(shot)! --- .../RoomInfoABACSection.spec.tsx.snap | 78 ++++++++++++------- 1 file changed, 48 insertions(+), 30 deletions(-) diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap index d5c6993d086e7..fa0fe4154f489 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap @@ -39,63 +39,81 @@ exports[`RoomInfoABACSection Snapshot should match the snapshot 1`] = ` ABAC_Managed_description
ABAC_Room_Attributes
- Chat-sensitivity
+ + Chat-sensitivity +
- - Classified + + Classified + - -
-
- +
- Top-Secret + + Top-Secret + - +
-
-
- Country
+ + Country +
- - US-only + + US-only + - +
From be7a0b837971918b7d19b52dc9fa8ed64693f13f Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Fri, 14 Nov 2025 17:10:01 -0300 Subject: [PATCH 07/11] review: ul li --- .../RoomInfo/ABAC/RoomInfoABACSection.tsx | 8 ++--- .../RoomInfoABACSection.spec.tsx.snap | 32 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx index 1fc722fbf3110..61154326bc8f8 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx @@ -42,15 +42,15 @@ const RoomInfoABACSection = ({ room }: RoomInfoABACSectionProps) => { {t('ABAC_Managed_description')} {t('ABAC_Room_Attributes')} - + {room.abacAttributes.map((attribute) => ( - + {attribute.name} - + {attribute.values.map((value) => ( - + {value} ))} diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap index fa0fe4154f489..43ec592f3181f 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/__snapshots__/RoomInfoABACSection.spec.tsx.snap @@ -43,11 +43,11 @@ exports[`RoomInfoABACSection Snapshot should match the snapshot 1`] = ` > ABAC_Room_Attributes
-
-
Chat-sensitivity -
-
-
-
+
  • -
  • -
    -
    -
    + + +
  • Country -
    -
    -
    -
    -
  • -
    + + + + From 41cbd35e2618ecc69e283b54f7a04b7cfe0cfb02 Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Mon, 17 Nov 2025 14:57:30 -0300 Subject: [PATCH 08/11] review: bunnyman review --- .../contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx index 61154326bc8f8..2306c8abea593 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx @@ -9,7 +9,7 @@ import { RoomIcon } from '../../../../../../components/RoomIcon'; // TODO: Remove type union when ABAC is implemented type RoomInfoABACSectionProps = { room: IRoom & { - abacAttributes: { + abacAttributes?: { name: string; values: string[]; }[]; @@ -22,7 +22,7 @@ const RoomInfoABACSection = ({ room }: RoomInfoABACSectionProps) => { const abacEnabled = useSetting('ABAC_Enabled'); const showAttributesInRoom = useSetting('ABAC_ShowAttributesInRooms'); - if (!abacEnabled || !showAttributesInRoom || room.abacAttributes?.length === 0) { + if (!abacEnabled || !showAttributesInRoom || !room.abacAttributes?.length) { return null; } From fb6b37cb0d1323ac6994bf08b8b3caaf459237e6 Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Mon, 17 Nov 2025 16:00:55 -0300 Subject: [PATCH 09/11] fix: ts --- .../Info/RoomInfo/ABAC/RoomInfoABACSection.tsx | 10 +++++----- .../room/contextualBar/Info/RoomInfo/RoomInfo.tsx | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx index 2306c8abea593..8c11bdde68f06 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.tsx @@ -10,7 +10,7 @@ import { RoomIcon } from '../../../../../../components/RoomIcon'; type RoomInfoABACSectionProps = { room: IRoom & { abacAttributes?: { - name: string; + key: string; values: string[]; }[]; }; @@ -44,11 +44,11 @@ const RoomInfoABACSection = ({ room }: RoomInfoABACSectionProps) => { {t('ABAC_Room_Attributes')} {room.abacAttributes.map((attribute) => ( - - - {attribute.name} + + + {attribute.key} - + {attribute.values.map((value) => ( {value} diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx index db7f96199c58d..23b2c1eaf2b66 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/RoomInfo.tsx @@ -129,7 +129,6 @@ const RoomInfo = ({ room, icon, onClickBack, onClickClose, onClickEnterRoom, onC )} {retentionPolicy?.isActive && } - {/* @ts-expect-error - abacAttributes is not yet implemented in Rooms properties */} From 222a52bfef0623f9f801bdb37fb440c451671e3c Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Mon, 17 Nov 2025 16:32:59 -0300 Subject: [PATCH 10/11] ts --- .../Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx index 2b975380407ca..edada330d315c 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx @@ -7,7 +7,7 @@ import RoomInfoABACSection from './RoomInfoABACSection'; import { createFakeRoom } from '../../../../../../../tests/mocks/data'; type RoomWithABAC = IRoom & { - abacAttributes: { + abacAttributes?: { name: string; values: string[]; }[]; From de5308712efac931dec6154e1af0aa744131af0d Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Mon, 17 Nov 2025 16:48:55 -0300 Subject: [PATCH 11/11] ts: ts --- .../RoomInfo/ABAC/RoomInfoABACSection.spec.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx index edada330d315c..7d3f745f655c7 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/RoomInfo/ABAC/RoomInfoABACSection.spec.tsx @@ -8,13 +8,13 @@ import { createFakeRoom } from '../../../../../../../tests/mocks/data'; type RoomWithABAC = IRoom & { abacAttributes?: { - name: string; + key: string; values: string[]; }[]; }; describe('RoomInfoABACSection', () => { - const createRoomWithABAC = (attributes: { name: string; values: string[] }[]): RoomWithABAC => { + const createRoomWithABAC = (attributes: { key: string; values: string[] }[]): RoomWithABAC => { const room = createFakeRoom(); return { ...room, @@ -26,7 +26,7 @@ describe('RoomInfoABACSection', () => { describe('Conditional rendering', () => { it('should return null when ABAC_Enabled is false', () => { - const room = createRoomWithABAC([{ name: 'Test', values: ['Value1'] }]); + const room = createRoomWithABAC([{ key: 'Test', values: ['Value1'] }]); const appRoot = mockAppRoot().withSetting('ABAC_Enabled', false).withSetting('ABAC_ShowAttributesInRooms', true).build(); render(, { wrapper: appRoot }); @@ -34,7 +34,7 @@ describe('RoomInfoABACSection', () => { }); it('should return null when ABAC_ShowAttributesInRooms is false', () => { - const room = createRoomWithABAC([{ name: 'Test', values: ['Value1'] }]); + const room = createRoomWithABAC([{ key: 'Test', values: ['Value1'] }]); const appRoot = mockAppRoot().withSetting('ABAC_Enabled', true).withSetting('ABAC_ShowAttributesInRooms', false).build(); render(, { wrapper: appRoot }); @@ -48,7 +48,7 @@ describe('RoomInfoABACSection', () => { }); it('should render when all conditions are met', () => { - const room = createRoomWithABAC([{ name: 'Test', values: ['Value1'] }]); + const room = createRoomWithABAC([{ key: 'Test', values: ['Value1'] }]); render(, { wrapper: appRootWithABACEnabled }); expect(screen.getByText('ABAC_Managed')).toBeInTheDocument(); }); @@ -57,8 +57,8 @@ describe('RoomInfoABACSection', () => { describe('Accessibility', () => { it('should have no accessibility violations', async () => { const room = createRoomWithABAC([ - { name: 'Chat-sensitivity', values: ['Classified', 'Top-Secret'] }, - { name: 'Country', values: ['US-only'] }, + { key: 'Chat-sensitivity', values: ['Classified', 'Top-Secret'] }, + { key: 'Country', values: ['US-only'] }, ]); const { container } = render(, { wrapper: appRootWithABACEnabled }); @@ -69,8 +69,8 @@ describe('RoomInfoABACSection', () => { describe('Snapshot', () => { it('should match the snapshot', () => { const room = createRoomWithABAC([ - { name: 'Chat-sensitivity', values: ['Classified', 'Top-Secret'] }, - { name: 'Country', values: ['US-only'] }, + { key: 'Chat-sensitivity', values: ['Classified', 'Top-Secret'] }, + { key: 'Country', values: ['US-only'] }, ]); const { baseElement } = render(, { wrapper: appRootWithABACEnabled }); expect(baseElement).toMatchSnapshot();