Skip to content

Add new room member actions and update interfaces#1

Open
shivang-16 wants to merge 1 commit intodevelopfrom
shivang-16-patch-1
Open

Add new room member actions and update interfaces#1
shivang-16 wants to merge 1 commit intodevelopfrom
shivang-16-patch-1

Conversation

@shivang-16
Copy link
Owner

@shivang-16 shivang-16 commented Nov 23, 2025

User description

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments


CodeAnt-AI Description

Provide more descriptive room actions and centralized controls

What Changed

  • Room member action list now includes announcement and description options so those interactions are surfaced alongside archive/leave controls
  • Room type configs can supply a label and expose shared helpers for join links, livechat detection, group-chat status, delete permissions, rename prevention, and discussion type, offering a consistent set of behaviors across clients
  • Server directives mirror the client helpers to keep permission checks, room lookups, and UI text consistent for room-related flows

Impact

✅ Clearer room action options
✅ Consistent room access checks
✅ Better room type descriptions

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • New Features
    • Enhanced room configuration system with support for additional room actions and management directives.
    • Expanded room type handling capabilities for better room identification and operation.

✏️ Tip: You can customize this high-level summary in your review settings.

@codeant-ai
Copy link

codeant-ai bot commented Nov 23, 2025

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@beetle-ai
Copy link

beetle-ai bot commented Nov 23, 2025

Summary by Beetle

This PR enhances the room type configuration system by adding new member actions for managing room announcements and descriptions, along with expanding the interface definitions for both client and server-side room type directives. The changes introduce two new room member action types (ANNOUNCEMENT and DESCRIPTION) and add a label property to the base room type configuration. Additionally, several method signatures are added to the directive interfaces to support enhanced room management capabilities.

File Changes Summary (Consolidated across all commits):

File Status Changes Description
apps/meteor/definition/IRoomTypeConfig.ts Modified +13/-0 Added new room member actions (ANNOUNCEMENT, DESCRIPTION), introduced optional label property to IRoomTypeConfig, and expanded both IRoomTypeClientDirectives and IRoomTypeServerDirectives interfaces with additional method signatures for room management operations including livechat detection, group chat identification, deletion permissions, renaming prevention, and discussion type retrieval

Total Changes: 1 file changed, +13 additions, -0 deletions

Walkthrough:

graph TD
A[IRoomTypeConfig Interface] --> B[RoomMemberActions Enum]
A --> C[IRoomTypeClientDirectives]
A --> D[IRoomTypeServerDirectives]
B --> B1[+ANNOUNCEMENT Action]
B --> B2[+DESCRIPTION Action]
A --> A1[+label Property]
C --> C1[showJoinLink]
C --> C2[isLivechatRoom]
C --> C3[isGroupChat]
C --> C4[canBeDeleted]
C --> C5[preventRenaming]
C --> C6[getDiscussionType]
D --> D1[extractOpenRoomParams]
D --> D2[findRoom]
D --> D3[showJoinLink]
D --> D4[isLivechatRoom]
D --> D5[isGroupChat]
D --> D6[canBeDeleted]
D --> D7[preventRenaming]
style B1 fill:#90EE90
style B2 fill:#90EE90
style A1 fill:#90EE90
Loading

Key Changes:

  • New Room Member Actions: Added ANNOUNCEMENT and DESCRIPTION actions to the RoomMemberActions enum, enabling granular permission control for managing room announcements and descriptions
  • Enhanced Type Configuration: Introduced optional label property to IRoomTypeConfig interface for better room type identification and display purposes
  • Expanded Client Directives: Added multiple method signatures to IRoomTypeClientDirectives including isLivechatRoom(), isGroupChat(), canBeDeleted(), preventRenaming(), and getDiscussionType() for comprehensive client-side room management
  • Expanded Server Directives: Extended IRoomTypeServerDirectives with methods like extractOpenRoomParams(), findRoom(), showJoinLink(), and isLivechatRoom() to support server-side room operations and validation
    Impact Assessment:
  • Security: Positive impact - The addition of ANNOUNCEMENT and DESCRIPTION actions enables more granular permission control for room management operations, allowing administrators to restrict who can modify room metadata
  • Performance: Neutral impact - These are interface definitions and enum additions that don't directly affect runtime performance; actual implementation will determine performance characteristics
  • Maintainability: Positive impact - The expanded interfaces provide better type safety and clearer contracts for room type implementations, making it easier for developers to understand required functionality and reducing potential runtime errors
  • Testing: Requires attention - New action types and interface methods will need corresponding test coverage to ensure proper permission checks and functionality across different room types (direct messages, channels, livechat, etc.)

@codeant-ai codeant-ai bot added the size:S This PR changes 10-29 lines, ignoring generated files label Nov 23, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 23, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

A single TypeScript type definitions file is expanded to include two new room action constants (ANNOUNCEMENT and DESCRIPTION), optional label properties added to room type configurations, and multiple new optional method signatures introduced to both client and server room type directives for handling room operations.

Changes

Cohort / File(s) Summary
Room Type Configuration Expansion
apps/meteor/definition/IRoomTypeConfig.ts
Added room action constants (ANNOUNCEMENT, DESCRIPTION) to RoomMemberActions; introduced optional label?: string property to IRoomTypeConfig and IRoomTypeClientConfig interfaces; extended IRoomTypeClientDirectives with eight new optional methods (extractOpenRoomParams, findRoom, showJoinLink, isLivechatRoom, isGroupChat, canBeDeleted, preventRenaming, getDiscussionType) for room handling; extended IRoomTypeServerDirectives with five new optional methods (extractOpenRoomParams, findRoom, showJoinLink, isLivechatRoom, getDiscussionType) for server-side room operations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Review method signature consistency and completeness across client and server directive interfaces
  • Verify optional chaining (?:) is properly applied where appropriate
  • Confirm return types for async methods (Promise, Promise) align with usage patterns

Poem

🐰 New directives bloom like clover in the spring,
Labels and methods, what treasures you bring!
Rooms can announce, discuss, and find their way,
With every new signature, we chat the whole day!
Hoppy refactoring! 🌿

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: addition of new room member actions (ANNOUNCEMENT, DESCRIPTION) and updates to multiple interfaces with new properties and methods.
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.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch shivang-16-patch-1

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.

isGroupChat: (room: IRoom) => boolean;
canBeDeleted: (hasPermission: (permissionId: string, rid?: string) => Promise<boolean> | boolean, room: IRoom) => Promise<boolean>;
preventRenaming: () => boolean;
getDiscussionType: (room?: AtLeast<IRoom, 'teamId'>) => Promise<Ro
Copy link

Choose a reason for hiding this comment

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

Suggestion: The new getDiscussionType signature in the client directives is truncated to Promise<Ro, making the interface invalid so any implementation or caller cannot compile; it must return Promise<RoomType> just like the server interface. [type error]

Severity Level: Minor ⚠️

Suggested change
getDiscussionType: (room?: AtLeast<IRoom, 'teamId'>) => Promise<Ro
getDiscussionType: (room?: AtLeast<IRoom, 'teamId'>) => Promise<RoomType>;
Why it matters? ⭐

The client directive interface now declares getDiscussionType returning the incomplete Promise<Ro, so TypeScript won't compile any implementation or consumer of this interface. Restoring Promise<RoomType> matches the server signature and fixes a real type error introduced by the PR.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/meteor/definition/IRoomTypeConfig.ts
**Line:** 95:95
**Comment:**
	*Type Error: The new `getDiscussionType` signature in the client directives is truncated to `Promise<Ro`, making the interface invalid so any implementation or caller cannot compile; it must return `Promise<RoomType>` just like the server interface.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

@codeant-ai
Copy link

codeant-ai bot commented Nov 23, 2025

CodeAnt AI finished reviewing your PR.

extractOpenRoomParams?: (routeParams: Record<string, string | null | undefined>) => { type: RoomType; reference: string };
findRoom: (identifier: string) => IRoom | undefined;
showJoinLink: (roomId: string) => boolean;
showJoinLink: (roomId: string) => boolean;
Copy link

Choose a reason for hiding this comment

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

Duplicate method declaration: The showJoinLink method is declared twice in the IRoomTypeClientDirectives interface (line 89 and line 90). This will cause a TypeScript compilation error.

Confidence: 5/5

Suggested Fix

Remove the duplicate declaration on line 90. The method is already declared earlier in the interface.

Copy link

@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: 2

Caution

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

⚠️ Outside diff range comments (1)
apps/meteor/definition/IRoomTypeConfig.ts (1)

65-67: Remove redundant property declaration.

The label?: string property is already inherited from IRoomTypeConfig (line 62). Re-declaring it in the extending interface is redundant and should be removed.

Apply this diff to remove the redundant declaration:

 export interface IRoomTypeClientConfig extends IRoomTypeConfig {
-  label?: string;
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65d2a45 and 82efc29.

📒 Files selected for processing (1)
  • apps/meteor/definition/IRoomTypeConfig.ts (4 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). (2)
  • GitHub Check: Beetle
  • GitHub Check: deploy-preview
🔇 Additional comments (1)
apps/meteor/definition/IRoomTypeConfig.ts (1)

107-114: LGTM! Server directives additions are clean.

The new method signatures for IRoomTypeServerDirectives are properly defined with no duplicates or syntax issues. The additions include extractOpenRoomParams, findRoom, showJoinLink, and isLivechatRoom, which align well with the client-side interface enhancements.

Comment on lines +42 to +43
ANNOUNCEMENT: 'roomAnnouncement',
DESCRIPTION: 'roomDescription',
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider distinct values for member actions vs. settings.

The values 'roomAnnouncement' and 'roomDescription' are already used in RoomSettingsEnum (lines 27-28). Using identical string values for both settings and member actions may cause confusion when these constants are used interchangeably, as settings and actions represent different concepts.

Consider using distinct prefixes or suffixes to differentiate between the two contexts:

 export const RoomMemberActions = {
   ARCHIVE: 'archive',
   IGNORE: 'ignore',
   BLOCK: 'block',
-  ANNOUNCEMENT: 'roomAnnouncement',
-  DESCRIPTION: 'roomDescription',
+  ANNOUNCEMENT: 'memberActionAnnouncement',
+  DESCRIPTION: 'memberActionDescription',
   MUTE: 'mute',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ANNOUNCEMENT: 'roomAnnouncement',
DESCRIPTION: 'roomDescription',
ANNOUNCEMENT: 'memberActionAnnouncement',
DESCRIPTION: 'memberActionDescription',
🤖 Prompt for AI Agents
In apps/meteor/definition/IRoomTypeConfig.ts around lines 42-43, the
ANNOUNCEMENT and DESCRIPTION entries currently reuse the same string values as
RoomSettingsEnum, which can cause confusion; change their string values to
distinct, context-specific identifiers (e.g., 'memberActionAnnouncement' and
'memberActionDescription' or add an "_ACTION" suffix) so they no longer collide
with settings, and update any references/usages across the codebase to the new
values to maintain consistency.

Comment on lines 87 to 96
extractOpenRoomParams?: (routeParams: Record<string, string | null | undefined>) => { type: RoomType; reference: string };
findRoom: (identifier: string) => IRoom | undefined;
showJoinLink: (roomId: string) => boolean;
showJoinLink: (roomId: string) => boolean;
isLivechatRoom: () => boolean;
isGroupChat: (room: IRoom) => boolean;
canBeDeleted: (hasPermission: (permissionId: string, rid?: string) => Promise<boolean> | boolean, room: IRoom) => Promise<boolean>;
preventRenaming: () => boolean;
getDiscussionType: (room?: AtLeast<IRoom, 'teamId'>) => Promise<Ro
isLivechatRoom: () => boolean;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Remove duplicate method definitions and fix truncated type.

This interface contains multiple critical issues that will prevent compilation:

  1. Duplicate showJoinLink on lines 89 and 90 with identical signatures
  2. Duplicate isGroupChat on lines 80 and 92 with inconsistent signatures: Partial<IRoom> vs IRoom
  3. Duplicate isLivechatRoom on lines 91 and 96 with identical signatures
  4. Truncated type definition for getDiscussionType on line 95 - return type shows Promise<Ro instead of complete type

Apply this diff to fix all issues:

   getIcon?: (room: Partial<IRoom>) => IconName;
   extractOpenRoomParams?: (routeParams: Record<string, string | null | undefined>) => { type: RoomType; reference: string };
   findRoom: (identifier: string) => IRoom | undefined;
   showJoinLink: (roomId: string) => boolean;
-  showJoinLink: (roomId: string) => boolean;
-  isLivechatRoom: () => boolean;
-  isGroupChat: (room: IRoom) => boolean;
   canBeDeleted: (hasPermission: (permissionId: string, rid?: string) => Promise<boolean> | boolean, room: IRoom) => Promise<boolean>;
   preventRenaming: () => boolean;
-  getDiscussionType: (room?: AtLeast<IRoom, 'teamId'>) => Promise<Ro
+  getDiscussionType: (room?: AtLeast<IRoom, 'teamId'>) => Promise<RoomType>;
   isLivechatRoom: () => boolean;
   canSendMessage: (rid: string) => boolean;

Note: Verify whether isGroupChat should accept Partial<IRoom> (line 80) or IRoom. The existing definition uses Partial<IRoom>, which is less restrictive.

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Biome (2.1.2)

[error] 96-96: expected , but instead found isLivechatRoom

Remove isLivechatRoom

(parse)


[error] 96-96: expected , but instead found :

Remove :

(parse)

🤖 Prompt for AI Agents
In apps/meteor/definition/IRoomTypeConfig.ts around lines 87–96, remove the
duplicated method declarations (extra showJoinLink, isLivechatRoom, and the
redundant isGroupChat) so each method is declared only once; reconcile
isGroupChat to use the intended parameter type (confirm and prefer
Partial<IRoom> if that matches the rest of the codebase) and update its single
signature accordingly; fix the truncated getDiscussionType return type by
completing it to the proper type (e.g., Promise<RoomType> or the actual
project-specific type) so the full signature is valid and the interface
compiles.

isGroupChat: (room: IRoom) => boolean;
canBeDeleted: (hasPermission: (permissionId: string, rid?: string) => Promise<boolean> | boolean, room: IRoom) => Promise<boolean>;
preventRenaming: () => boolean;
getDiscussionType: (room?: AtLeast<IRoom, 'teamId'>) => Promise<Ro
Copy link

Choose a reason for hiding this comment

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

Incomplete method signature: The getDiscussionType method signature is truncated and incomplete. The return type Promise<Ro is cut off, which will cause a TypeScript compilation error.

Confidence: 5/5

Suggested Fix

Complete the method signature with the full return type. Based on the context, it likely should be something like:

Suggested change
getDiscussionType: (room?: AtLeast<IRoom, 'teamId'>) => Promise<Ro
getDiscussionType: (room?: AtLeast<IRoom, 'teamId'>) => Promise<RoomType>;

Verify the correct return type from the implementation or related type definitions.

Comment on lines +107 to +110
extractOpenRoomParams?: (routeParams: Record<string, string | null | undefined>) => { type: RoomType; reference: string };
findRoom: (identifier: string) => IRoom | undefined;
showJoinLink: (roomId: string) => boolean;
isLivechatRoom: () => boolean;
Copy link

Choose a reason for hiding this comment

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

Incorrect method placement: The methods extractOpenRoomParams, findRoom, showJoinLink, and isLivechatRoom appear to be client-side methods that were incorrectly added to the IRoomTypeServerDirectives interface. These methods are already present in IRoomTypeClientDirectives and don't belong in the server directives interface.

Confidence: 5/5

Suggested Fix

Remove these four method declarations from IRoomTypeServerDirectives as they are client-side methods and should only exist in IRoomTypeClientDirectives. Server directives should contain only server-specific operations.

📍 This suggestion applies to lines 107-110

@github-actions
Copy link

PR Preview Action v1.6.3

🚀 View preview at
https://shivang-16.github.io/Rocket.Chat/pr-preview/pr-1/

Built to branch gh-pages at 2025-11-23 18:24 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant