Open
Conversation
Reactions are parsed from REST history and gateway events are dispatched,
but nothing was rendered. Wire through display and mutation so the UI
reflects reaction state in real time.
Message domain grows add/remove/clear helpers, used both by the REST
seed path and by the three gateway events (MESSAGE_REACTION_ADD,
MESSAGE_REACTION_REMOVE, MESSAGE_REACTION_REMOVE_ALL). Chips render as
`{emoji} {count}` below content/attachments/embeds, wrapping across
lines when they exceed message width; the current user's own reactions
use the theme accent + bold, others are dimmed.
4bd10c7 to
b939cad
Compare
Owner
|
I don't have enough time to review the PR right now, but I'll take a look as soon as I have a chance. I have a lot of work to do with the repository (issues and such). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes #2 (reactions portion) / revives intent of #27.
Reactions were already parsed from the REST message payload (
parse_reactionsinclient.rs) and the gateway codec already decodedMESSAGE_REACTION_ADD,MESSAGE_REACTION_REMOVE, andMESSAGE_REACTION_REMOVE_ALL. The app subscribed to the reaction intent but the three dispatch events only emitteddebug!logs, and the message pane never drew the reactions that did arrive via REST. This PR closes that gap.Changes
domain/entities/message.rs—Message::add_reaction / remove_reaction / clear_reactionsencapsulate list mutation (increment/decrement withmetracking, drop entries at zero).ReactionEmoji::display()renders unicode emoji verbatim and custom guild emoji as:name:.presentation/widgets/message_pane.rs— newformat_reaction_linesbuilds indented chip rows ({emoji} {count}) that wrap oncontent_width,UiMessagecaches them,layout_messageandcalculate_message_heightfold them into the existing O(1) geometry, andrender_ui_messagepaints them after embeds.MessagePaneStylegainsreaction_me_style(theme accent + bold) andreaction_other_style(dimmed).MessagePaneData::apply_reaction_{add,remove,remove_all}mutate the cachedArc<Message>viaArc::make_mutand invalidate layout for that row only.presentation/ui/chat_screen.rs/app.rs— wires the three gateway dispatch events through to the pane, resolvingis_meagainstcurrent_user_id.No new dependencies. No new allocations on the hot render path beyond the cached chip lines. The reaction intent was already enabled via
GatewayIntents::with_reactions().Visual proof
Snapshot test that renders the reactions through a real
ratatui::buffer::Buffer(reaction_lines_buffer_snapshot, run with-- --nocapture):The first snapshot shows unicode emoji (
❤,👍) and a custom guild emoji (:wave:) rendered inline with their counts at the CONTENT_INDENT column. The second shows the same reactions forced to wrap at width 16 — chips never split mid-chip, and each wrapped row re-applies the indent so the block stays visually aligned with the message body. In a real terminal session,❤ 3would be drawn in the theme accent + bold (it hasme: true);👍 1and:wave: 2in dim gray.Tests
10 new unit tests, all green:
Full suite:
test result: ok. 275 passed; 0 failed; 1 ignored.cargo clippy --all-targetsintroduces no new warnings.Not in scope
:name:is the canonical representation.