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"
(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))
(from +table-status+)
(where (:= :folder
(tag->folder-name tag))))))
(max-status-id (second max-status-id-row))
(max-ignored-status-id-row (fetch-single (select (fields (:max :status-id))
(from +table-ignored-status+)
(where (:= :folder
(tag->folder-name tag))))))
(max-ignored-status-id (second max-ignored-status-id-row)))
(or max-status-id
max-ignored-status-id)))
(max-status-id (second max-status-id-row)))
(if (not include-ignored)
max-status-id
(let* ((max-ignored-status-id-row (fetch-single (select (fields (:max :status-id))
(from +table-ignored-status+)
(where (:= :folder
(tag->folder-name tag))))))
(max-ignored-status-id (second max-ignored-status-id-row)))
(or max-status-id
max-ignored-status-id)))))
(defun more-recent-tag-fetched-p (tag)
"Returns the most recent message fetched that contains tag `tag', or
nil if no such message exists"
(when-let* ((row (fetch-from-id +table-subscribed-tag+ tag)))
(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)
(string> max-status-id-fetched
last-status-id)))))
(and max-status-id-fetched
(string> max-status-id-fetched
last-status-id))))))
(defun all-tags-with-new-message-fetched ()
"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)))
(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+
(:last-status-id-fetched)
(max-status-id)

View File

@ -977,7 +977,7 @@
(defmethod process-event ((object tag-mark-got-messages-event))
(loop for tag in (db:all-tags-with-new-message-fetched) do
(db:mark-tag-got-new-messages tag)))
(db:mark-tag-got-new-messages tag)))
(defclass refresh-tag-window-event (program-event) ())