Allow users to disable auto-remove

Adds ARCHIVE_READ_DAYS="-1"
This commit is contained in:
Jacob Wahlgren 2019-03-10 18:51:21 +01:00 committed by fguillot
parent 6764a420b0
commit 22b68eefd8

View file

@ -188,6 +188,9 @@ func (s *Storage) UpdateEntries(userID, feedID int64, entries model.Entries, upd
// ArchiveEntries changes the status of read items to "removed" after specified days. // ArchiveEntries changes the status of read items to "removed" after specified days.
func (s *Storage) ArchiveEntries(days int) error { func (s *Storage) ArchiveEntries(days int) error {
if days < 0 {
return nil
}
query := fmt.Sprintf(` query := fmt.Sprintf(`
UPDATE entries SET status='removed' UPDATE entries SET status='removed'
WHERE id=ANY(SELECT id FROM entries WHERE status='read' AND starred is false AND published_at < now () - '%d days'::interval LIMIT 5000) WHERE id=ANY(SELECT id FROM entries WHERE status='read' AND starred is false AND published_at < now () - '%d days'::interval LIMIT 5000)