Add per-user read state and the request-response endpoints - #53
Draft
andremion wants to merge 4 commits into
Draft
Add per-user read state and the request-response endpoints#53andremion wants to merge 4 commits into
andremion wants to merge 4 commits into
Conversation
Track read state per user per channel: sending a message advances the author's read state and increments unread_messages for the other members, mark-read stores last_read, and the new mark-unread endpoint rewinds it and broadcasts notification.mark_unread. New endpoints: pinned messages query, message search, threads query, reactions query, flag, mute/unmute user, mute/unmute channel, block/unblock/list blocked users, channel delete, reminder CRUD plus query, mark-delivered ACK, and a /create_reminder chat robot endpoint that seeds server-side reminders for tests. Stamp all generated dates with microsecond precision like the real backend: clients drop read-state updates whose event timestamp is not strictly newer than the last processed one, so second-precision stamps lose one unread increment per same-second event.
Contributor
Author
|
Started e2e tests on this branch: |
Seeding the participant with last_read at mock time marked every seeded message as read by the participant, flipping the delivery status checkmarks the MessageDeliveryStatusTests and GiphyTests count. The participant's read entry is created on demand by /participant/read, like before.
The backend deletes read state when a member is removed from a channel. Serving the stale entry on a later channel query re-added the removed member as a reader and flipped the delivery status back to read.
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.
Goal
Add mock server support for the request-response Compose features so the Android e2e suite can cover them. These features either call endpoints the mock does not implement (unhandled requests return 404) or need per-user read state the mock does not maintain.
Related: AND-1329. Companion PR with the Android tests: GetStream/stream-chat-android#6596 (this PR must merge first).
Implementation
src/helpers/reads.rb)./mockseeds every channel with both users fully read. A new channel message incrementsunread_messagesfor the other members and advances the author's own read state, like the real backend. The mark-read endpoint storeslast_readandlast_read_message_id. The new mark-unread endpoint rewinds the state to the given message and broadcastsnotification.mark_unread./participant/readreuses the same helper.notification.mutes_updated), mute and unmute channel (broadcastsnotification.channel_mutes_updated), block, unblock and list blocked users, channel delete (broadcastschannel.deleted), reminder create, update, delete and query, and an ACK for/channels/delivered(the Android SDK kept retrying it against the 404 every second).POST /create_reminderseeds a server-side reminder on the last message, because reminders cannot be created from the sample app UI.Testing
bundle exec rubocop: no offenses.UnreadMessagesTestslocally against this branch: the three previously ignored tests (unread separator, jump to unread, dismiss indicator) plus a new mark-as-unread test are all green when run with per-test data isolation, matching how CI runs them. Against main these tests cannot pass because the mock serves no real read state.