feat: Add star icon display for starred messages#6937
feat: Add star icon display for starred messages#6937deepak0x wants to merge 1 commit intoRocketChat:developfrom
Conversation
- Create Starred component to display star icon when message is starred - Add starred prop to RightIcons component and interface - Pass starred prop through Message, User, and MessageContainer components - Implement optimistic updates for star action to show immediate UI feedback - Add starred to optimisticUpdates helper to prevent server race conditions - Update room.ts updateMessage to prioritize recent optimistic starred updates - Add starred to IMessageContent interface - Refactor handleStar to accept message object and implement optimistic updates with error rollback
WalkthroughThis PR implements visual star icon display for starred messages by introducing a new Starred component, propagating the starred property through the message component hierarchy, enhancing the star action handler with optimistic updates and rollback capability, and establishing in-memory tracking of optimistic UI changes. Changes
Sequence DiagramsequenceDiagram
actor User as User
participant UI as MessageActions UI
participant Handler as handleStar Handler
participant DB as Database
participant Cache as Optimistic Cache
participant Server as Server API
User->>UI: Clicks star icon
UI->>Handler: handleStar(message)
Handler->>Cache: registerOptimisticUpdate(messageId, {starred: true})
Handler->>DB: protectedMutation (update message.starred)
Handler->>DB: Write to database
activate Server
Handler->>Server: Send star request
Server-->>Handler: Success/Failure
deactivate Server
alt Server succeeds
Handler->>Cache: Update remains (implicit via timestamp)
Handler->>UI: Emit STAR_S event
else Server fails
Handler->>DB: Rollback via protectedMutation
Handler->>Cache: clearOptimisticUpdate(messageId)
Handler->>UI: Emit STAR_F event (log error)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
This PR adds visual star icon display for starred messages. When a message is starred, a star icon now appears immediately in the message's right icons area, providing instant visual feedback to users.
The implementation includes:
Starred.tsxcomponent that displays the star icon when a message is starredThis feature improves user experience by providing immediate visual confirmation when messages are starred, making it easier for users to identify starred messages at a glance.
Issue(s)
Closes #6935
How to test or reproduce
Screenshots/video
Screen.Recording.2026-01-21.at.6.11.23.PM.mov
Types of changes
Checklist