Add new room member actions and update interfaces#1
Add new room member actions and update interfaces#1shivang-16 wants to merge 1 commit intodevelopfrom
Conversation
|
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 · |
Summary by BeetleThis 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 ( File Changes Summary (Consolidated across all commits):
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
Key Changes:
|
|
Note Other AI code review bot(s) detectedCodeRabbit 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. WalkthroughA 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
| 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 |
There was a problem hiding this comment.
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
| 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 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?: stringproperty is already inherited fromIRoomTypeConfig(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
📒 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
IRoomTypeServerDirectivesare properly defined with no duplicates or syntax issues. The additions includeextractOpenRoomParams,findRoom,showJoinLink, andisLivechatRoom, which align well with the client-side interface enhancements.
| ANNOUNCEMENT: 'roomAnnouncement', | ||
| DESCRIPTION: 'roomDescription', |
There was a problem hiding this comment.
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.
| 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.
| 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; |
There was a problem hiding this comment.
Critical: Remove duplicate method definitions and fix truncated type.
This interface contains multiple critical issues that will prevent compilation:
- Duplicate
showJoinLinkon lines 89 and 90 with identical signatures - Duplicate
isGroupChaton lines 80 and 92 with inconsistent signatures:Partial<IRoom>vsIRoom - Duplicate
isLivechatRoomon lines 91 and 96 with identical signatures - Truncated type definition for
getDiscussionTypeon line 95 - return type showsPromise<Roinstead 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 |
There was a problem hiding this comment.
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:
| 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.
| extractOpenRoomParams?: (routeParams: Record<string, string | null | undefined>) => { type: RoomType; reference: string }; | ||
| findRoom: (identifier: string) => IRoom | undefined; | ||
| showJoinLink: (roomId: string) => boolean; | ||
| isLivechatRoom: () => boolean; |
There was a problem hiding this comment.
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
|
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
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:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
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:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
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
✏️ Tip: You can customize this high-level summary in your review settings.