Fix wrong overload of queryMetadataAll being called#1269
Open
NatsuCamellia wants to merge 1 commit intoReadYouApp:mainfrom
Open
Fix wrong overload of queryMetadataAll being called#1269NatsuCamellia wants to merge 1 commit intoReadYouApp:mainfrom
NatsuCamellia wants to merge 1 commit intoReadYouApp:mainfrom
Conversation
|
OMG thanks! |
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.
Problem
queryMetadataAllhas these two overloads:The call site was:
articleDao.queryMetadataAll(accountId, !isUnread)Because
!isUnreadis aBoolean, Kotlin resolves this to the first overload, treating!isUnreadassortAscendinginstead ofisUnread. As a result, the unread filter is never applied and articles are always queried without considering their read status. Because of this, Read You marks all the articles as read, including the articles already read. This triggered another bug in Miniflux and made me find this bug.Fix
Use a named argument to ensure the correct overload is dispatched:
Context
This bug was discovered while investigating a related issue in Miniflux (miniflux/v2#4277), where marking an already-read entry as read would incorrectly toggle it back to unread. Even though fixing Miniflux would mask the symptom on the server side, the incorrect dispatch here is an independent bug — Read You was never calling the intended overload regardless of server behavior.