Skip to content

chore: add missing abacAttributes to useRoomIcon Pick type#38427

Open
NAME-ASHWANIYADAV wants to merge 6 commits intoRocketChat:developfrom
NAME-ASHWANIYADAV:fix/use-room-icon-abac-type
Open

chore: add missing abacAttributes to useRoomIcon Pick type#38427
NAME-ASHWANIYADAV wants to merge 6 commits intoRocketChat:developfrom
NAME-ASHWANIYADAV:fix/use-room-icon-abac-type

Conversation

@NAME-ASHWANIYADAV
Copy link
Contributor

@NAME-ASHWANIYADAV NAME-ASHWANIYADAV commented Jan 29, 2026

Proposed changes

Fixes an outdated @ts-expect-error TODO in the useRoomIcon hook by adding
proper TypeScript typing for abacAttributes.

Related issue

Changes made

File Changes
apps/meteor/client/hooks/useRoomIcon.tsx Added abacAttributes to the Pick<IRoom, …> type and removed the @ts-expect-error
apps/meteor/client/hooks/useRoomIcon.spec.tsx Removed 8 @ts-expect-error comments and fixed test data types

Why this change?

  • abacAttributes was added to IRoom in PR feat: ABAC #37091, but useRoomIcon was not updated accordingly.
  • The existing TODO and @ts-expect-error are now stale.
  • Test fixtures were using incorrect types (boolean instead of IAbacAttributeDefinition[]).

Verification

  • ✅ TypeScript compilation passes
  • ✅ No functional or visual changes
  • ✅ Existing tests remain valid

Summary by CodeRabbit

  • Refactor

    • Improved room icon handling to recognize structured access-control attributes; preserves existing icon visuals while honoring attribute presence for team/direct rooms.
  • Tests

    • Updated test fixtures to match the revised access-control attribute structure.

https://rocketchat.atlassian.net/browse/COMM-126

@NAME-ASHWANIYADAV NAME-ASHWANIYADAV requested a review from a team as a code owner January 29, 2026 18:22
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jan 29, 2026

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 8.2.0, but it targets 8.1.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 Jan 29, 2026

⚠️ No Changeset found

Latest commit: 27cebba

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 Jan 29, 2026

Walkthrough

This PR adds abacAttributes to the useRoomIcon hook's parameter type, removes stale @ts-expect-error suppressions, and updates test fixtures to use correctly typed ABAC attribute arrays instead of boolean placeholders.

Changes

Cohort / File(s) Summary
Hook type update
apps/meteor/client/hooks/useRoomIcon.tsx
Added abacAttributes to the Pick<IRoom, ...> parameter type and removed the @ts-expect-error so the hook can reference room.abacAttributes with proper typing.
Test fixture updates
apps/meteor/client/hooks/useRoomIcon.spec.tsx
Replaced boolean abacAttributes values in room mocks with undefined or IAbacAttributeDefinition[] objects and removed multiple @ts-expect-error suppressions.
Changeset
.changeset/fix-use-room-icon-abac-type.md
Added a patch changeset documenting the typing fix and test fixture updates.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • tassoevan
  • KevLehman

Poem

🐰 I found a type that hid in the hay,
I nibbled the errors and chased them away.
ABAC now tidy, fixtures all right,
I hop with a carrot, and code through the night. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding the missing abacAttributes to the useRoomIcon Pick type, which aligns with the actual code modifications.
Linked Issues check ✅ Passed All objectives from issue #38426 are addressed: abacAttributes added to Pick type, @ts-expect-error removed from implementation, all 8 instances removed from tests, and test fixtures updated with proper IAbacAttributeDefinition[] types.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the ABAC attributes typing issue. The changeset file, hook implementation, and test updates are all within scope of issue #38426.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/meteor/client/hooks/useRoomIcon.tsx (1)

8-16: Guard against empty ABAC arrays.

if (room.abacAttributes) treats [] as ABAC-enabled, which can show shield icons even when attributes are cleared. Consider gating on .length instead.

Proposed fix
-	if (room.abacAttributes) {
+	if (room.abacAttributes?.length) {

Based on learnings: The GET /v1/abac/rooms endpoint only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }).

@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.37%. Comparing base (5b5082f) to head (27cebba).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #38427      +/-   ##
===========================================
- Coverage    70.40%   70.37%   -0.03%     
===========================================
  Files         3161     3161              
  Lines       110639   110638       -1     
  Branches     19870    19901      +31     
===========================================
- Hits         77895    77867      -28     
- Misses       30717    30743      +26     
- Partials      2027     2028       +1     
Flag Coverage Δ
e2e 60.35% <ø> (-0.03%) ⬇️
e2e-api 47.80% <ø> (-0.08%) ⬇️
unit 71.37% <100.00%> (-0.02%) ⬇️

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.

Copy link
Member

@MartinSchoeler MartinSchoeler left a comment

Choose a reason for hiding this comment

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

This is a chore pr, change the title prefix to chore: and remove the changeset

@NAME-ASHWANIYADAV NAME-ASHWANIYADAV changed the title fix: add missing abacAttributes to useRoomIcon Pick type chore: add missing abacAttributes to useRoomIcon Pick type Jan 29, 2026
@NAME-ASHWANIYADAV
Copy link
Contributor Author

NAME-ASHWANIYADAV commented Jan 29, 2026

I have updated the title and removed the changeset file . Now please re-review it @MartinSchoeler

@NAME-ASHWANIYADAV NAME-ASHWANIYADAV force-pushed the fix/use-room-icon-abac-type branch from b6628df to ccf7439 Compare February 2, 2026 16:13
Copy link
Member

Choose a reason for hiding this comment

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

pls remove changeset for chore prs

@NAME-ASHWANIYADAV
Copy link
Contributor Author

i have deleted the changeset sorry it was my mistake
plz re-review it @KevLehman

@dougfabris dougfabris added contrib: valid A valid contribution where maintainers will review based on priority and removed community:valid labels Feb 5, 2026
@KevLehman KevLehman added the stat: QA assured Means it has been tested and approved by a company insider label Feb 5, 2026
@KevLehman KevLehman added this to the 8.2.0 milestone Feb 5, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contrib: valid A valid contribution where maintainers will review based on priority 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.

fix: Add missing abacAttributes to useRoomIcon Pick type

4 participants