Private
Public Access
Composer gains an emoji picker (static curated unicode list, insert at cursor position) and messages gain Slack/Mattermost-style reactions: react with any emoji, toggle off by reacting again, see who reacted via a tooltip on each pill. Backend: MessageReaction model (unique on message_id+user_id+emoji backs toggle semantics), WS "reaction" envelope broadcasts the full recomputed reaction list per message (same approach as message edits), REST message list embeds reactions so a reload doesn't lose state that only arrived over WS. Frontend: shared EmojiPicker component (anchored popover, Escape/outside- click dismiss via new useEscapeKey hook) used by both the composer and a new hover-revealed reaction trigger on each message row.
25 lines
491 B
Python
25 lines
491 B
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
class ReactionSummary(BaseModel):
|
|
emoji: str
|
|
count: int
|
|
user_ids: list[str]
|
|
|
|
|
|
class MessageRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: uuid.UUID
|
|
room_id: uuid.UUID
|
|
user_id: uuid.UUID
|
|
username: str
|
|
content: str | None
|
|
image_id: uuid.UUID | None
|
|
reactions: list[ReactionSummary]
|
|
created_at: datetime
|
|
edited_at: datetime | None
|