Let marking unread, favoriting and archiving survive being offline or killed - #6719
Draft
AndyScherzinger wants to merge 1 commit into
Draft
AndyScherzinger wants to merge 1 commit into
AndyScherzinger wants to merge 1 commit into
Conversation
… app All three reverted themselves when the request did not come back, so a tap taken offline flickered and a tap taken just before the app was killed was lost. They now go to a worker, the way the read marker does, which waits for a connection and survives the process. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
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.
Stacked on #6717, which is stacked on #6715 and #6694 — review those first. This branch targets
feat/noid/optimisticRemindersand will be retargeted as the stack merges.Marking a conversation unread, favoriting it and archiving it were optimistic but not durable. The local entry changed at once, then the request had two attempts in the view model's scope, and anything that stopped it there reverted the change. Two cases that made worse:
feat(conversation list): let unread, favorite and archive outlive the app— the three actions now hand the request to a newConversationActionWorker, the way the read marker already goes throughReadMarkerSyncWorker. The worker carries aNetworkType.CONNECTEDconstraint, so a change made offline waits for a connection instead of being discarded, and it retries with exponential backoff across process death. Work is unique per conversation and action withREPLACE, so favoriting and unfavoriting in quick succession sends only the last intent, while archiving and marking unread on the same conversation stay independent.This is only safe because each of these sets a value rather than moving one. Verified against a Nextcloud 36 dev instance running Talk
main:POST …/favorite,POST …/archiveandDELETE …/chat/{token}/readeach answer200twice in a row and leave the same state, so a retry can never overshoot. That is the opposite of the note-to-self share in #6717, which has no such guarantee and therefore reads back before retrying.Failure handling keeps both halves. While the list is still on screen it observes the work and, when the worker has used up its attempts, puts the conversation back and shows the error snackbar exactly as before. When the list is gone the worker releases the pending guard instead, and the next room list sync restores the server state.
Known limitation, deliberately not solved here. The pending guard lives in memory in
ConversationListUpdater. If the process dies before the worker runs, the guard is gone, so a room list sync between the restart and the worker finishing can show the old value for a moment before the worker's success brings it back. Making the guard durable means persisting it next to the conversation entry, which is a schema change and its own review.🖼️ Screenshots
No UI was added or changed. The archive snackbar now appears when the row moves rather than when the server answers.
🏁 Checklist
🤖 AI (if applicable)