Repository navigation
fix(#604): a restore keeps its read state and blocklist, nudges expire - #605
Merged
Merged
Conversation
The merge import added one unread per inserted message on top of the conversation's restored unread_count, so a thread with 80 read messages came back as 80 unread. Read state is one number per conversation, so RestoreUnread.toAdd() adds nothing to a conversation the backup inserted whole and at most the backup's unread count — never more than the messages the merge actually inserted — to one it merged into. The merge never read conversations.blocked, so a restored blocked sender landed in the Inbox while its blocklist row was copied. Both columns are carried now through an adaptive conversation SELECT, because blocking postdates soft delete and an older backup has neither column, and a blocked conversation the merge creates also reaches the blocklist. The in-process block cache is cleared after either import mode. The reply nudge had a lower age bound and no ceiling, so enabling it surfaced every old unanswered thread. Past a week the message is history; the policy and the row query share one constant. Tests: RestoreUnreadTest, LegacyBackupSchemaTest and ReplyNudgePolicyTest. Scripts test-restore-state.sh (12/12) and test-reply-nudge.sh (14/14) on emulator-5558. The Trash behaviour is unchanged.
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.
Refs #604 (the restore and nudge parts).
What changed
unread_count, so a read 80-message thread came back as 80 unread.RestoreUnread.toAdd()adds nothing to a conversation the backup inserted whole, and at most the backup's unread count — never more than the messages actually inserted — to one it merged into.conversations.blocked/blocked_at, so the thread landed in the Inbox while its blocklist row was copied. Both columns are carried through an adaptive conversation SELECT (an older backup has neither), and a blocked conversation the merge creates also joins the blocklist. The block cache is cleared after either import mode.MAX_AGE_HOURS.Not changed
Verification
./gradlew testDebugUnitTestgreen:RestoreUnreadTest4,LegacyBackupSchemaTest5,ReplyNudgePolicyTest12.scripts/test-restore-state.sh12/12 onemulator-5558: the half-read thread keeps 2 unread, the read thread stays read, the blocked sender stays blocked and on the blocklist, and all five messages are present.scripts/test-reply-nudge.sh14/14: the three-month-old thread is not nudged and the existing nudge flow still works.