Do not archive shared items
This commit is contained in:
parent
3371b15631
commit
e32fa059e5
1 changed files with 5 additions and 4 deletions
|
@ -215,15 +215,16 @@ func (s *Storage) ArchiveEntries(days int) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
before := time.Now().AddDate(0, 0, -days)
|
||||
query := `
|
||||
UPDATE
|
||||
entries
|
||||
SET
|
||||
status='removed'
|
||||
status=$1
|
||||
WHERE
|
||||
id=ANY(SELECT id FROM entries WHERE status='read' AND starred is false AND published_at < now () - '%d days'::interval LIMIT 5000)
|
||||
id=ANY(SELECT id FROM entries WHERE status=$2 AND starred is false AND share_code='' AND published_at < $3 LIMIT 5000)
|
||||
`
|
||||
if _, err := s.db.Exec(fmt.Sprintf(query, days)); err != nil {
|
||||
if _, err := s.db.Exec(query, model.EntryStatusRemoved, model.EntryStatusRead, before); err != nil {
|
||||
return fmt.Errorf(`store: unable to archive read entries: %v`, err)
|
||||
}
|
||||
|
||||
|
@ -279,7 +280,7 @@ func (s *Storage) FlushHistory(userID int64) error {
|
|||
status=$1,
|
||||
changed_at=now()
|
||||
WHERE
|
||||
user_id=$2 AND status=$3 AND starred='f' AND share_code=''
|
||||
user_id=$2 AND status=$3 AND starred is false AND share_code=''
|
||||
`
|
||||
_, err := s.db.Exec(query, model.EntryStatusRemoved, userID, model.EntryStatusRead)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue