Skip to content

Conversation

@mrubens
Copy link
Collaborator

@mrubens mrubens commented Jun 30, 2025

<!--
Thank you for contributing to Roo Code!

Before submitting your PR, please ensure:
- It's linked to an approved GitHub Issue.
- You've reviewed our [Contributing Guidelines](../CONTRIBUTING.md).
-->

### Related GitHub Issue

<!-- Every PR MUST be linked to an approved issue. -->

Closes: # <!-- Replace with the issue number, e.g., Closes: #123 -->

### Description

This PR introduces an emoji reaction feature, allowing users to add emoji reactions to any visible task messages.

Key implementation details include:
- **Schema Extension**: The `ClineMessage` type in `packages/types/src/message.ts` was extended to include a `reactions` field (mapping emoji strings to counts).
- **Frontend Component**: A new `EmojiReactions.tsx` component was created to display reactions, provide an emoji picker, and handle user interactions.
- **UI Integration**: The `ChatRow.tsx` component was updated to integrate the `EmojiReactions` component for text, completion, and user feedback message types. Reactions are only displayed for complete (non-partial) messages.
- **Backend Logic**: `Task.ts` now includes `addReaction` and `removeReaction` methods to manage reaction counts, ensuring persistence and real-time updates via `postStateToWebview`.
- **Communication Protocol**: `WebviewMessage.ts` and `webviewMessageHandler.ts` were updated to support `addReaction` and `removeReaction` message types for communication between the webview and the extension backend.

This feature provides an intuitive way for users to interact with task messages, with reactions persisting across sessions and updating in real-time.

### Test Procedure

To test this feature:
1.  Open a task in Roo Code that contains various types of messages (e.g., AI text responses, completion results, user feedback).
2.  Hover over an eligible message (non-partial text, completion, or user feedback). A small "😊" button should appear.
3.  Click the "😊" button to open the emoji picker.
4.  Click on several different emojis (e.g., 👍, ❤️, 😂) to add reactions. Verify that the emoji and its count appear next to the message.
5.  Click on an existing reaction button to remove your reaction. Verify that the count decreases or the reaction disappears if it was the last one.
6.  Add multiple reactions to the same message and verify counts update correctly.
7.  Close and reopen the task, or restart VS Code, to verify that reactions persist.
8.  Verify that reactions do not appear on message types that are not text, completion, or user feedback (e.g., tool outputs, diffs).

### Pre-Submission Checklist

<!-- Go through this checklist before marking your PR as ready for review. -->

- [ ] **Issue Linked**: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
- [x] **Scope**: My changes are focused on the linked issue (one major feature/fix per PR).
- [x] **Self-Review**: I have performed a thorough self-review of my code.
- [x] **Testing**: New and/or updated tests have been added to cover my changes (if applicable).
- [x] **Documentation Impact**: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
- [x] **Contribution Guidelines**: I have read and agree to the [Contributor Guidelines](/CONTRIBUTING.md).

### Screenshots / Videos

<!--
For UI changes, please provide before-and-after screenshots or a short video of the *actual results*.
This greatly helps in understanding the visual impact of your changes.
-->
Please provide screenshots or a short video demonstrating the emoji reaction feature in action, showing:
-   The "😊" button appearing on hover.
-   The emoji picker opening.
-   Adding and removing reactions.
-   Reaction counts updating.

### Documentation Updates

<!--
Does this PR necessitate updates to user-facing documentation?
- [ ] No documentation updates are required.
- [ ] Yes, documentation updates are required. (Please describe what needs to be updated or link to a PR in the docs repository).
-->
- [ ] No documentation updates are required.
- [x] Yes, documentation updates are required. A detailed implementation summary has been added to `emoji-reactions-implementation.md` which can be used to update user-facing documentation.

### Additional Notes

None.

### Get in Touch

<!--
Please provide your Discord username for reviewers or maintainers to reach you if they have questions about your PR
-->
[Your Discord Username]

Important

Add emoji reactions to task messages with real-time updates and persistence across sessions.

  • Behavior:
    • Add emoji reactions to task messages via EmojiReactions.tsx component.
    • Reactions are available for text, completion, and user feedback messages.
    • Reactions persist across sessions and update in real-time.
  • Schema and Backend:
    • Extend ClineMessage in message.ts to include reactions field.
    • Add addReaction and removeReaction methods in Task.ts for managing reactions.
    • Update webviewMessageHandler.ts to handle addReaction and removeReaction messages.
  • UI Integration:
    • Integrate EmojiReactions in ChatRow.tsx for eligible message types.
    • Handle user interactions for adding/removing reactions.

This description was created by Ellipsis for cbdecd1. You can customize this summary. It will automatically update as commits are pushed.

@mrubens mrubens requested review from cte and jr as code owners June 30, 2025 20:13
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. documentation Improvements or additions to documentation enhancement New feature or request labels Jun 30, 2025
@mrubens
Copy link
Collaborator Author

mrubens commented Jun 30, 2025

Lol thanks cursor

@mrubens mrubens closed this Jun 30, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 30, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jun 30, 2025
@delve-auditor
Copy link

delve-auditor bot commented Jun 30, 2025

No security or compliance issues detected. Reviewed everything up to cbdecd1.

Security Overview
  • 🔎 Scanned files: 7 changed file(s)
Detected Code Changes
Change Type Relevant files
Enhancement ► emoji-reactions-implementation.md
    Implementation guide for emoji reactions feature
► packages/types/src/message.ts
    Add reactions field to message schema
► src/core/task/Task.ts
    Add reaction handling methods
► src/core/webview/webviewMessageHandler.ts
    Add reaction message handlers
► src/shared/WebviewMessage.ts
    Add reaction message types
► webview-ui/src/components/chat/ChatRow.tsx
    Integrate emoji reactions in chat interface
► webview-ui/src/components/chat/EmojiReactions.tsx
    New emoji reactions component

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

size="sm"
className="h-6 w-6 p-0 text-xs hover:bg-vscode-button-secondaryHoverBackground"
onClick={() => setShowPicker(!showPicker)}
title="Add reaction"
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider localizing the 'Add reaction' button title instead of hardcoding it. Use a translation function (e.g., t('emojiReactions.add')) to support multiple languages.

Suggested change
title="Add reaction"
title={t('emojiReactions.add')}

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

setShowPicker(false)
}

const hasReactions = Object.keys(reactions).some(emoji => reactions[emoji] > 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

The computed variable 'hasReactions' is declared but not used. Remove it to simplify the code.

Suggested change
const hasReactions = Object.keys(reactions).some(emoji => reactions[emoji] > 0)

@daniel-lxs
Copy link
Member

Wrong repo 😆

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

Labels

documentation Improvements or additions to documentation enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants