Skip to content

feat: react to remote messages with emoji - #452

Merged
xHeaven merged 3 commits into
dev-null-sh:productionfrom
xHeaven:feat/message-reactions
Oct 18, 2026
Merged

xHeaven merged 3 commits into
dev-null-sh:productionfrom
xHeaven:feat/message-reactions

Conversation

@xHeaven

@xHeaven xHeaven commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Remote messages had no way to react. A quick acknowledgement meant pushing a whole message ("👍", "on it").

Now you can react to any message in a conversation or org:

  • Desktop: hovering a message shows a pill over its top corner with three quick reactions and a picker button. The picker is a searchable grid: your most used emoji first, then every emoji grouped like a keyboard. Arrow keys move through it from the search field, Enter reacts, and the footer names the emoji you're on.
  • Touch: long-pressing a message lifts it with large quick reactions above it, plus Copy text, since long-press no longer selects text. The picker button opens a bottom sheet with the same search and grid.
  • Double tap: on touch, double tapping a message leaves a ❤️, and double tapping again takes it back. Taps on links, buttons and images don't count.
  • Chips: reactions show as chips under the message, in the order they were first left. Tap a chip to add or take back your reaction; hover it to see who reacted.
  • Ranking: quick reactions start as 😂 ✅ ❤️. An emoji you use takes the weakest slot, in place, only once you've used it 3 more times than that slot, so the bar changes slowly and the rest stay put. Picker search puts the emoji you use most first within each kind of name match.
  • Live updates: other people's reactions show up on their next thread poll (about 2–4 s in local testing), even on older messages.

Reacting on desktop

Quick-reacting, taking a reaction back, then searching the picker and reacting with Enter

MP4

Double tap to heart (touch emulation)

Double tapping a message adds a heart, double tapping again takes it back

MP4

Reacting on a phone (touch emulation)

Long-pressing a message, opening the sheet, searching and picking an emoji

MP4

Hover, light Hover, dark
Hover bar light Hover bar dark
Picker, light Picker, dark
Picker light Picker dark
Search ranked by use New user's defaults (😂 ✅ ❤️)
Search Defaults
Mobile thread Long press Sheet
Mobile thread light Long press light Sheet light
Mobile thread dark Long press dark Sheet dark

Implementation

  • Data: a new message_reactions table (message, user, emoji; unique per triple). Emoji are stored as the character and must be one a shortcode stands for. Each person can leave up to 12 different emoji on a message.
  • Endpoints: POST/DELETE remotes/messages/{message}/reactions and GET remotes/reactions (your usage counts), on the conversations throttle. Reacting needs what pushing needs: an org role, or an open conversation with the partner. A fetched request can't be reacted to until it's merged, blocked pairs get 404, and org events can't be reacted to. Taking a reaction back only needs the message to be visible.
  • Polling: polls only fetch messages after the last id, so reactions on older messages need their own cursor. Each reaction change bumps conversations.reactions_version and stamps the message with the new value, in one transaction. Thread responses now include reactions_version, and polls send reactions_after to get reaction_changes (the current reactions of every message that changed since then). The version is read before the messages, so a change landing mid-poll is sent again next time instead of being skipped.
  • Touch gestures: one hook handles long press and double tap (two taps within 300 ms and 24 px; tested in Reactions.test.ts). After a double tap it cancels the browser's emulated mouse events, so no word gets selected. The long-press overlay ignores the release of the finger that opened it, so lifting it over a quick reaction doesn't react.
  • Client: toggles are optimistic and settle on the server's reply. Polls don't overwrite a message with a reaction in flight, or one changed after the poll was sent. If the server refuses, the toggle is rolled back with a toast.
  • Emoji data: the grouped set (resources/js/lib/emoji-groups.json) was generated once from Unicode's emoji-test.txt, limited to the 1,870 emoji our shortcodes cover. It loads as its own chunk when you first hover or open the picker.

Validation

  • vendor/bin/pest on the affected suites: MessageReactionControllerTest (new), Conversation*, Org*, Message*, Inbox*, DatabaseTest, DatabaseSeederTest, ArchTest. 135 passed.
  • bun run test:unit (47 passed, including the new Reactions.test.ts); vp test run tests/Unit/EmojiSearch.test.tsx (5 passed).
  • bun run test:types, bun run test:lint, Pint, plus PHPStan and Rector (dry run) on the touched PHP files.
  • Touch emulation: a double tap adds ❤️ and a second removes it (checked in the database), a single tap does nothing, releasing a long press over a quick reaction doesn't react, and Copy text puts the body on the clipboard.
  • In the browser: two signed-in users on one org. A reaction from one reached the other in 2.1 s, and a removal in 4.1 s. Layout shift: 0 when toggling a chip on a message that already has chips, 0.0008 when the first chip row appears on another person's message.

Limitations

  • Code coverage wasn't measured locally (no coverage driver installed); CI's 100% gate will check it. Every new branch has a feature test.
  • Layout shift was measured only for reaction toggles, with no side-by-side comparison against production.
  • Mobile media uses Chrome touch emulation, not a real device.
  • Reactions don't send notifications or change the inbox preview.

@xHeaven
xHeaven merged commit 590a227 into dev-null-sh:production Oct 18, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant