Skip to content

Pin messages (GRYT-1619) - #281

Merged
sivert-io merged 1 commit into
mainfrom
claude/GRYT-1619-pinned-messages
Oct 6, 2026
Merged

sivert-io merged 1 commit into
mainfrom
claude/GRYT-1619-pinned-messages

Conversation

@sivert-io

Copy link
Copy Markdown
Member

Server half of pinned messages. The client and phone UI come next, in their own PRs.

What changes

  • Migration: messages.pinned_at and pinned_by (both nullable TEXT), plus a partial index on (conversation_id, pinned_at) WHERE pinned_at IS NOT NULL. Existing rows are untouched.
  • chat:pin {conversationId, messageId, pinned, accessToken}. You need manage_messages in a channel. In a DM or group any participant can pin. It's rate-limited like edits, and capped at 50 pins per conversation. It broadcasts chat:pinned {conversation_id, message_id, pinned_at, pinned_by} to the conversation.
  • chat:pins {conversationId} replies with chat:pins {conversation_id, items}, newest pin first, enriched the same way chat:fetch is. Senders you've blocked are filtered out.

Please look at

  • The migration in connection.ts. It's review-required because it's under db/.
  • The DM rule. Letting either side of a DM pin matches what Discord does, but it's a judgement call.
  • Pinning something that's already pinned succeeds and rebroadcasts the current state rather than returning an error. That's on purpose, so a double tap isn't an error.

Tests: pins.test.ts covers pin, list order, unpin, the missing-message case and conversation scoping. The full suite passes (1986).

🤖 Generated with Claude Code

Two nullable columns on messages, pinned_at and pinned_by, plus a partial
index for listing them. chat:pin sets or clears them and broadcasts
chat:pinned to the conversation. chat:pins returns the list, newest pin first.

In a channel you need manage_messages to pin. In a DM or group anyone in it
can, since there's nobody else to ask. A conversation tops out at 50 pins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sivert-io
sivert-io merged commit 98f93e6 into main Oct 6, 2026
6 checks passed
@sivert-io
sivert-io deleted the claude/GRYT-1619-pinned-messages branch October 6, 2026 12:51
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