Skip to content

Fix wrong overload of queryMetadataAll being called#1269

Open
NatsuCamellia wants to merge 1 commit intoReadYouApp:mainfrom
NatsuCamellia:natsucamellia
Open

Fix wrong overload of queryMetadataAll being called#1269
NatsuCamellia wants to merge 1 commit intoReadYouApp:mainfrom
NatsuCamellia:natsucamellia

Conversation

@NatsuCamellia
Copy link
Copy Markdown

@NatsuCamellia NatsuCamellia commented May 2, 2026

Problem

queryMetadataAll has these two overloads:

fun queryMetadataAll(
    accountId: Int, sortAscending: Boolean = false
): List

fun queryMetadataAll(
    accountId: Int, isUnread: Boolean, sortAscending: Boolean = false
): List

The call site was:

articleDao.queryMetadataAll(accountId, !isUnread)

Because !isUnread is a Boolean, Kotlin resolves this to the first overload, treating !isUnread as sortAscending instead of isUnread. 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:

articleDao.queryMetadataAll(accountId, isUnread = !isUnread)

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.

@NatsuCamellia
Copy link
Copy Markdown
Author

@steakscience
Copy link
Copy Markdown

OMG thanks!

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.

2 participants