Skip to content

Fix wrong overload of queryMetadataAll being called#1269

Merged
Ashinch merged 1 commit into
ReadYouApp:mainfrom
NatsuCamellia:natsucamellia
May 15, 2026
Merged

Fix wrong overload of queryMetadataAll being called#1269
Ashinch merged 1 commit into
ReadYouApp:mainfrom
NatsuCamellia:natsucamellia

Conversation

@NatsuCamellia
Copy link
Copy Markdown
Contributor

@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
Contributor Author

@steakscience
Copy link
Copy Markdown

OMG thanks!

@Ashinch Ashinch merged commit 59e6f66 into ReadYouApp:main May 15, 2026
2 checks passed
@Ashinch
Copy link
Copy Markdown
Member

Ashinch commented May 15, 2026

Sweet, merging this now 🙌

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.

3 participants