Skip to content

Instantly share code, notes, and snippets.

@aqt
Last active March 31, 2024 09:05
Show Gist options
  • Save aqt/d152e3b240b240ff098e6a071a312e2c to your computer and use it in GitHub Desktop.
Save aqt/d152e3b240b240ff098e6a071a312e2c to your computer and use it in GitHub Desktop.
Mark new entries, with an old publish date, as read in Miniflux

Miniflux version 2.1.2 introduces a new configuration parameter FILTER_ENTRY_MAX_AGE_DAYS. One difference in behavior is that that approach will ignore new entries, while this trigger adds them marked as read.


Deprecated

Miniflux version 2.0.45

This problem has annoyed me for a while. Old entries are suddenly added to the feeds in my Miniflux instance. Sometimes as old as several years.

I've not spent a single second investigating why this happens as I assume it's the fault of the server. Now I finally had enough, as Youtube suddenly started adding a lot of extremely old live streams that have never even aired.

Connect to the postgres database and execute these commands:

Define the function that the trigger will call

CREATE FUNCTION mark_old_as_read() RETURNS TRIGGER AS $$
BEGIN
    IF NEW.published_at < (current_timestamp - interval '1 month') THEN
        NEW.status = 'read';
    END IF;
    RETURN NEW;
END;
$$ LANGUAGE plpgsql;

Create the trigger

CREATE TRIGGER mark_old_as_read_trigger
BEFORE INSERT ON entries
FOR EACH ROW
EXECUTE FUNCTION mark_old_as_read();

To clean up if you don't want this behavior anymore:

DROP TRIGGER mark_old_as_read_trigger ON entries;
DROP FUNCTION mark_old_as_read();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment