Skip to content

refactor(admin-user-info): remove any usage and enforce strict typing in AdminUserInfoActions#39041

Open
srijnabhargav wants to merge 1 commit intoRocketChat:developfrom
srijnabhargav:fix/sanitize-admin-user-info-actions-type
Open

refactor(admin-user-info): remove any usage and enforce strict typing in AdminUserInfoActions#39041
srijnabhargav wants to merge 1 commit intoRocketChat:developfrom
srijnabhargav:fix/sanitize-admin-user-info-actions-type

Conversation

@srijnabhargav
Copy link

@srijnabhargav srijnabhargav commented Feb 25, 2026

Fixes: #39040

What changed

  • Replaced unsafe any in AdminUserInfoActions mapAction with [string, AdminUserAction]
  • Added missing disabled?: boolean to AdminUserAction type
  • Removed obsolete TODO comment about sanitizing action type

Why

This aligns AdminUserInfoActions with strict typing and removes unsafe casts without changing behavior.

Impact

  • No runtime changes
  • Better type safety and maintainability

Summary by CodeRabbit

  • New Features

    • Admin user actions can now be marked as disabled when needed.
  • Refactor

    • Improved type safety and consistency across admin user management features to reduce potential errors.

@srijnabhargav srijnabhargav requested a review from a team as a code owner February 25, 2026 09:41
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Feb 25, 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.3.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 Feb 25, 2026

⚠️ No Changeset found

Latest commit: 92715df

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 Feb 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 813d57a and 92715df.

📒 Files selected for processing (2)
  • apps/meteor/client/views/admin/users/AdminUserInfoActions.tsx
  • apps/meteor/client/views/admin/users/hooks/useAdminUserInfoActions.ts
📜 Recent review details
⏰ 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: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/admin/users/hooks/useAdminUserInfoActions.ts
  • apps/meteor/client/views/admin/users/AdminUserInfoActions.tsx
🧠 Learnings (1)
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/views/admin/users/hooks/useAdminUserInfoActions.ts
🧬 Code graph analysis (1)
apps/meteor/client/views/admin/users/AdminUserInfoActions.tsx (1)
apps/meteor/client/views/admin/users/hooks/useAdminUserInfoActions.ts (1)
  • AdminUserAction (15-23)
🔇 Additional comments (3)
apps/meteor/client/views/admin/users/hooks/useAdminUserInfoActions.ts (1)

15-23: LGTM — formalises existing runtime usage.

disabled was already assigned in the editUsereditUser action (line 134) but absent from the type. This addition is accurate and non-breaking.

apps/meteor/client/views/admin/users/AdminUserInfoActions.tsx (2)

7-7: LGTM — correct co-import of the extended type.


51-53: Both concerns are verified as correct.

  1. UserInfoAction accepts disabled via ComponentProps<typeof Button> from the fuselage Button component, which includes the disabled prop.

  2. 'kebab' is a valid IconName from @rocket.chat/icons (imported as Keys), confirmed by extensive usage throughout the codebase. The default value ensures the icon prop is always provided to UserInfoAction, maintaining type safety.


Walkthrough

The changes improve type safety in the admin user actions components by removing any type usage, replacing it with explicit [string, AdminUserAction] tuple typing, and adding a missing disabled? boolean property to the AdminUserAction type definition.

Changes

Cohort / File(s) Summary
Type Safety Improvements
apps/meteor/client/views/admin/users/AdminUserInfoActions.tsx
Replaced unsafe any type with explicit [string, AdminUserAction] tuple in mapAction parameter; added default 'kebab' icon value.
Type Extension
apps/meteor/client/views/admin/users/hooks/useAdminUserInfoActions.ts
Added optional disabled?: boolean property to AdminUserAction type to formally support disabled action state.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 With whiskers twitching at types so true,
No more any shadows in code I review,
Tuples and booleans now shine so bright,
Admin actions typed just right!

🚥 Pre-merge checks | ✅ 5
✅ 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 describes the main change: removing unsafe any typing and enforcing strict typing in AdminUserInfoActions component.
Linked Issues check ✅ Passed All objectives from issue #39040 are met: replaced any with typed tuple [string, AdminUserAction], added optional disabled?: boolean to AdminUserAction type, and removed obsolete TODO comment.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the linked issue #39040 objectives; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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

@ggazzo ggazzo added this to the 8.3.0 milestone Feb 25, 2026
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Feb 25, 2026
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.64%. Comparing base (c7966fa) to head (92715df).
⚠️ Report is 220 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #39041      +/-   ##
===========================================
- Coverage    70.66%   70.64%   -0.03%     
===========================================
  Files         3136     3190      +54     
  Lines       108599   112740    +4141     
  Branches     19538    20685    +1147     
===========================================
+ Hits         76742    79640    +2898     
- Misses       29856    31053    +1197     
- Partials      2001     2047      +46     
Flag Coverage Δ
e2e 60.36% <0.00%> (+0.02%) ⬆️
e2e-api 47.83% <ø> (-0.21%) ⬇️
unit 71.25% <ø> (-0.46%) ⬇️

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.

@ggazzo ggazzo assigned ggazzo and unassigned ggazzo Feb 27, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type-safety: remove any usage in AdminUserInfoActions

2 participants