1
0
Fork 0

- prevented false positives for new message in the subscribed tags.

This commit is contained in:
cage 2023-10-14 12:32:45 +02:00
parent ea9675c832
commit f393812207
2 changed files with 17 additions and 14 deletions

View File

@ -2759,29 +2759,32 @@ of (timeline, folder) pairs that has statuses marked for deletion."
name" name"
(cl-ppcre:regex-replace +folder-tag-prefix+ folder "")) (cl-ppcre:regex-replace +folder-tag-prefix+ folder ""))
(defun max-status-id-subscribed-tag (tag) (defun max-status-id-subscribed-tag (tag &key (include-ignored t))
(let* ((max-status-id-row (fetch-single (select (fields (:max :status-id)) (let* ((max-status-id-row (fetch-single (select (fields (:max :status-id))
(from +table-status+) (from +table-status+)
(where (:= :folder (where (:= :folder
(tag->folder-name tag)))))) (tag->folder-name tag))))))
(max-status-id (second max-status-id-row)) (max-status-id (second max-status-id-row)))
(max-ignored-status-id-row (fetch-single (select (fields (:max :status-id)) (if (not include-ignored)
max-status-id
(let* ((max-ignored-status-id-row (fetch-single (select (fields (:max :status-id))
(from +table-ignored-status+) (from +table-ignored-status+)
(where (:= :folder (where (:= :folder
(tag->folder-name tag)))))) (tag->folder-name tag))))))
(max-ignored-status-id (second max-ignored-status-id-row))) (max-ignored-status-id (second max-ignored-status-id-row)))
(or max-status-id (or max-status-id
max-ignored-status-id))) max-ignored-status-id)))))
(defun more-recent-tag-fetched-p (tag) (defun more-recent-tag-fetched-p (tag)
"Returns the most recent message fetched that contains tag `tag', or "Returns the most recent message fetched that contains tag `tag', or
nil if no such message exists" nil if no such message exists"
(when-let* ((row (fetch-from-id +table-subscribed-tag+ tag))) (when-let* ((row (fetch-from-id +table-subscribed-tag+ tag)))
(let* ((last-status-id (db-getf row :last-status-id-fetched)) (let* ((last-status-id (db-getf row :last-status-id-fetched))
(max-status-id-fetched (max-status-id-subscribed-tag tag))) (max-status-id-fetched (max-status-id-subscribed-tag tag :include-ignored nil)))
(or (null last-status-id) (or (null last-status-id)
(and max-status-id-fetched
(string> max-status-id-fetched (string> max-status-id-fetched
last-status-id))))) last-status-id))))))
(defun all-tags-with-new-message-fetched () (defun all-tags-with-new-message-fetched ()
"Returns the most recent messages fetched that contains subscribed tags, or "Returns the most recent messages fetched that contains subscribed tags, or
@ -2790,7 +2793,7 @@ nil if no such messages exist"
(all-subscribed-tags-name))) (all-subscribed-tags-name)))
(defun update-last-seen-status-with-tag (tag) (defun update-last-seen-status-with-tag (tag)
(when-let* ((max-status-id (max-status-id-subscribed-tag tag))) (when-let* ((max-status-id (max-status-id-subscribed-tag tag :include-ignored nil)))
(query (make-update +table-subscribed-tag+ (query (make-update +table-subscribed-tag+
(:last-status-id-fetched) (:last-status-id-fetched)
(max-status-id) (max-status-id)