Skip to content

Conversation

@MartinSchoeler
Copy link
Member

@MartinSchoeler MartinSchoeler commented Oct 2, 2025

Proposed changes (including videos or screenshots)

Added a new tag and tooltip to be shown when the room is under Attribute Based Access Control

V1 Header:
Screenshot 2025-10-02 at 14 10 07

V2 Header:
Screenshot 2025-10-02 at 14 10 55

Issue(s)

ABAC-44

Steps to test or reproduce

Not reproducible yet since the abac property on the rooms is yet to be implemented

Further comments

I've changed the min width of the headerTags for it avoid extra padding on smaller tags, an example of the issue:
Screenshot 2025-10-02 at 13 42 36
Let me know if a separate PR would be better.

I've set the PR as chore since these changes are not available without mocking data

Summary by CodeRabbit

  • New Features

    • Added an ABAC tag in room headers when rooms use attribute-based access control, with a descriptive title explaining access requirements and localized label.
  • Style

    • Reduced the minimum width of header tags for a more compact layout and improved truncation across header views.
  • Tests

    • Added unit and accessibility tests (rendering, snapshots, and axe checks) for the ABAC tag and header tag components.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 2, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 7.12.0, but it targets 7.11.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Oct 2, 2025

⚠️ No Changeset found

Latest commit: 61d26f5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 2, 2025

Walkthrough

Adds an ABACHeaderTag component and tests, integrates it into both RoomHeader variants, adds two English i18n keys, and reduces HeaderTag minWidth from x64 to x32 in both Header and HeaderV2 components.

Changes

Cohort / File(s) Summary
ABAC header tag component & tests
apps/meteor/client/components/ABAC/ABACHeaderTag.tsx, apps/meteor/client/components/ABAC/ABACHeaderTag.spec.tsx
New ABACHeaderTag component that renders a HeaderTag when room.abacAttributes exists; unit and accessibility tests (snapshot + axe checks) added.
Room header integrations
apps/meteor/client/views/room/Header/RoomHeader.tsx, apps/meteor/client/views/room/HeaderV2/RoomHeader.tsx
Import and render <ABACHeaderTag room={room} /> in both RoomHeader implementations (inserted into the header row).
HeaderTag min-width tweak
packages/ui-client/src/components/Header/HeaderTag/HeaderTag.tsx, packages/ui-client/src/components/HeaderV2/HeaderTag/HeaderTag.tsx
Changed Box prop minWidth from 'x64' to 'x32' (layout adjustment for truncated tags).
Localization
packages/i18n/src/locales/en.i18n.json
Added ABAC_header_tag and ABAC_header_tag_title English translation keys.
HeaderTag unit test
packages/ui-client/src/components/HeaderV2/HeaderTag/HeaderTag.spec.tsx
New snapshot test for HeaderTag.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant RoomView as Room View
  participant RoomHeader as RoomHeader
  participant ABAC as ABACHeaderTag
  participant Tag as HeaderTag

  User->>RoomView: open room
  RoomView->>RoomHeader: mount with room
  RoomHeader->>ABAC: render <ABACHeaderTag room>
  alt room.abacAttributes present
    ABAC->>Tag: create HeaderTag with label t("ABAC") and title t("ABAC_header_tag_title")
    Tag-->>RoomHeader: rendered visible tag
  else no abac attributes
    ABAC-->>RoomHeader: return null (no tag)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • aleksandernsilva

Poem

A carrot-bright tag on the header shelf,
I hop in swift to mark rooms for rightful self.
Tiny badge of ABAC, clear and neat,
Tests and i18n make the change complete.
Thump-thump — the rabbit signs with a beat. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately summarizes the primary change by indicating the addition of header tags for ABAC rooms and is concise and clear without extraneous details.
Linked Issues Check ✅ Passed The pull request fully implements the requirements of ABAC-44 by adding an ABACHeaderTag component with translations, integrating it into both header variants, adjusting tag styling for the new UI element, and covering it with tests to ensure correct rendering and accessibility.
Out of Scope Changes Check ✅ Passed All modifications are directly tied to the ABAC header tag feature or its supporting styling and test coverage, and no unrelated or extraneous changes are present in the pull request.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/ABAC-header-tag

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1de331c and 61d26f5.

📒 Files selected for processing (1)
  • packages/i18n/src/locales/en.i18n.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/i18n/src/locales/en.i18n.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.41%. Comparing base (3309f90) to head (61d26f5).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37126      +/-   ##
===========================================
- Coverage    67.45%   67.41%   -0.05%     
===========================================
  Files         3332     3334       +2     
  Lines       113607   113698      +91     
  Branches     20604    20623      +19     
===========================================
+ Hits         76631    76644      +13     
- Misses       34378    34449      +71     
- Partials      2598     2605       +7     
Flag Coverage Δ
e2e 57.33% <80.00%> (-0.08%) ⬇️
unit 71.17% <100.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MartinSchoeler MartinSchoeler marked this pull request as ready for review October 2, 2025 18:00
@MartinSchoeler MartinSchoeler requested a review from a team as a code owner October 2, 2025 18:00
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/meteor/client/components/ABAC/ABACHeaderTag.spec.tsx (1)

14-23: Consider stronger typing for the overrides parameter.

The any type for overrides bypasses type safety. Consider using Partial<IRoom> or a more specific type to catch potential misuse.

Apply this diff to improve type safety:

+import type { IRoom } from '@rocket.chat/core-typings';
+
-const createMockRoom = (overrides: any = {}) => ({
+const createMockRoom = (overrides: Partial<IRoom> = {}) => ({
 	_id: 'room-id',
 	t: 'c' as const,
 	name: 'test-room',
 	msgs: 0,
 	u: { _id: 'user-id', username: 'testuser' },
 	usersCount: 1,
 	_updatedAt: new Date(),
 	...overrides,
-});
+}) as IRoom;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 40a45d8 and b7c1f7d.

⛔ Files ignored due to path filters (1)
  • apps/meteor/client/components/ABAC/__snapshots__/ABACHeaderTag.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (7)
  • .changeset/slow-trees-eat.md (1 hunks)
  • apps/meteor/client/components/ABAC/ABACHeaderTag.spec.tsx (1 hunks)
  • apps/meteor/client/components/ABAC/ABACHeaderTag.tsx (1 hunks)
  • apps/meteor/client/views/room/Header/RoomHeader.tsx (2 hunks)
  • apps/meteor/client/views/room/HeaderV2/RoomHeader.tsx (2 hunks)
  • packages/ui-client/src/components/Header/HeaderTag/HeaderTag.tsx (1 hunks)
  • packages/ui-client/src/components/HeaderV2/HeaderTag/HeaderTag.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/meteor/client/components/ABAC/ABACHeaderTag.tsx (1)
packages/core-typings/src/IRoom.ts (1)
  • IRoom (21-95)
apps/meteor/client/components/ABAC/ABACHeaderTag.spec.tsx (1)
packages/mock-providers/src/index.ts (1)
  • mockAppRoot (3-3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: 🚢 Build Docker Images for Testing (alpine)
🔇 Additional comments (8)
packages/ui-client/src/components/HeaderV2/HeaderTag/HeaderTag.tsx (1)

7-7: LGTM: minWidth reduction improves tag layout.

The reduction from x64 to x32 eliminates unnecessary padding for smaller tags as described in the PR objectives.

packages/ui-client/src/components/Header/HeaderTag/HeaderTag.tsx (1)

5-5: LGTM: minWidth reduction consistent with HeaderV2.

The change mirrors the HeaderV2 variant and ensures consistent tag sizing across both header implementations.

.changeset/slow-trees-eat.md (1)

1-6: LGTM: Changeset properly documents the feature.

The changeset correctly identifies the affected packages and provides a clear description of the ABAC header tag feature.

apps/meteor/client/components/ABAC/ABACHeaderTag.tsx (2)

1-28: LGTM: Clean component implementation with appropriate conditional rendering.

The component correctly:

  • Uses translation hooks for i18n support
  • Applies warning color styling via Palette
  • Returns null when ABAC attributes are absent
  • Imports HeaderTag from the correct path

20-22: Confirm translation keys exist in i18n resources. Ensure ABAC_header_tag_title and ABAC_header_tag are defined in your locale files (e.g. *.json, *.js or *.ts under /locales or i18n); add them if they’re missing.

apps/meteor/client/views/room/HeaderV2/RoomHeader.tsx (1)

15-15: LGTM: ABACHeaderTag properly integrated into HeaderV2.

The component is imported correctly and rendered in an appropriate position within the header row, consistent with other header tags like Favorite and FederatedRoomOriginServer.

Also applies to: 47-47

apps/meteor/client/views/room/Header/RoomHeader.tsx (1)

16-16: LGTM: ABACHeaderTag properly integrated into Header.

The component is imported correctly and rendered in an appropriate position, maintaining consistency with the HeaderV2 implementation.

Also applies to: 54-54

apps/meteor/client/components/ABAC/ABACHeaderTag.spec.tsx (1)

25-77: Excellent test coverage with accessibility checks.

The test suite thoroughly covers:

  • Snapshot testing for visual regression
  • Conditional rendering (presence, absence, undefined, null)
  • Accessibility validation for both rendered and non-rendered states

The use of mockAppRoot with translations and the createMockRoom helper demonstrates good testing practices.

@MartinSchoeler MartinSchoeler added this to the 7.12.0 milestone Oct 2, 2025
@MartinSchoeler MartinSchoeler changed the title feat: Header tags for ABAC rooms chore: Header tags for ABAC rooms Oct 3, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/ui-client/src/components/HeaderV2/HeaderTag/HeaderTag.spec.tsx (1)

5-8: Add accessibility and behavioral tests.

The test suite only includes a snapshot test, which doesn't verify functionality or accessibility. According to best practices, tests should use user-centric queries to ensure the component is accessible and works as expected.

Consider adding tests that verify:

  • The component renders the expected text content using screen.getByText
  • Accessibility attributes (role, aria-label if applicable)
  • Different scenarios or prop variations if the component supports them

Example enhancement:

 import { render } from '@testing-library/react';
+import { screen } from '@testing-library/react';

 import HeaderTag from './HeaderTag';

+it('should render the tag text', () => {
+	render(<HeaderTag>Test Tag</HeaderTag>);
+	expect(screen.getByText('Test Tag')).toBeInTheDocument();
+});
+
 it('should match snapshot', () => {
 	const { baseElement } = render(<HeaderTag>Test Tag</HeaderTag>);
 	expect(baseElement).toMatchSnapshot();
 });

Based on learnings

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4a3d5f5 and 1de331c.

⛔ Files ignored due to path filters (2)
  • apps/meteor/client/components/ABAC/__snapshots__/ABACHeaderTag.spec.tsx.snap is excluded by !**/*.snap
  • packages/ui-client/src/components/HeaderV2/HeaderTag/__snapshots__/HeaderTag.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • packages/ui-client/src/components/HeaderV2/HeaderTag/HeaderTag.spec.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Oct 6, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 6, 2025
@kodiakhq kodiakhq bot merged commit 287f302 into develop Oct 6, 2025
50 checks passed
@kodiakhq kodiakhq bot deleted the feat/ABAC-header-tag branch October 6, 2025 14:56
debdutdeb pushed a commit that referenced this pull request Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants