Fix: "Mark as Read" buttons don't work (#398) #399
Merged
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.
This PR implements two separate fixes for the issues outlined in #398. Building Read You with these changes fixes the "Mark as Read" buttons on my environment.
Here are the details:
Part 1: Send the
before
parameter correctlyAs detailed in the original docs, the Fever API requires a
before
parameter (formatted as a Unix timestamp) in requests to update a feed or category as read (before
a certain time). My prior understanding was that this is meant to be represented in seconds; the Wikipedia entry for Unix time and some of my own investigations [1][2][3] support this. Most applications (including popular Fever endpoints) seem to expect seconds.Read You, however, appears to send the Fever
before
parameter as milliseconds instead of seconds. This causes the Fever endpoints to think that the request is to mark all stories before some time in the extremely distant future as read. This is obviously not what the user wants.Unfortunately, the original Fever API docs don't explicitly state whether that timestamp is supposed to be in seconds or milliseconds, but given all the context clues, I think it makes most sense to send the
before
parameter as seconds. Therefore, this PR simply converts milliseconds to seconds before performing the POST request against the Fever API.Part 2: Send the
before
parameter correctly (...again)When clicking the
Mark All as Read
button, Read You defaults the Feverbefore
parameter to a value ofDate(Long.MAX_VALUE).time
. While this makes some sense, it appears to break at least some RSS readers, who just drop the request and don't mark anything as read. Converting this time to seconds doesn't help. Instead, this PR sets that value to the current time, which makes more logical sense and - crucially - appears to actually work.Tagging @Ashinch for review. Resolves #398 and resolves #383 (please confirm if you're able @scottbetza)
Love the app, and can't wait to see where it goes next! 😄
References
[1]: Read You's own Fever documentation contains Unix timestamp values that make most sense as seconds, rather than milliseconds.
[2]: Miniflux's Fever handler expects time in seconds.
[3]: FreshRSS' Fever API documentation contains example timestamps that also make the most sense in seconds rather than milliseconds.