mirror of https://codeberg.org/cage/tinmop/
- added 'hooks:*after-getting-all-fediverse-notifications*';
- trigger the script to fetch expired polls only after all the notifications has been fetched from the server.
This commit is contained in:
parent
a4e93f59d3
commit
43eeb4c613
|
@ -16,26 +16,27 @@
|
|||
|
||||
(in-package :modules)
|
||||
|
||||
(defun fetch-expired-poll-from-notification (notification)
|
||||
(notify "Checking for expired polls.")
|
||||
(when (eq (tooter:kind notification)
|
||||
:poll)
|
||||
(let* ((timeline (thread-window:timeline-type *thread-window*))
|
||||
(folder (thread-window:timeline-folder *thread-window*))
|
||||
(status (tooter:status notification))
|
||||
(status-id (tooter:id status))
|
||||
(refresh-event (make-instance 'refresh-thread-windows-event
|
||||
:priority +minimum-event-priority+
|
||||
:message-status-id status-id)))
|
||||
(notify "Fetching expired poll")
|
||||
(program-events:with-enqueued-process ()
|
||||
(db:update-db (api-client:get-remote-status status-id)
|
||||
:folder folder
|
||||
:timeline timeline
|
||||
:skip-ignored-p nil)
|
||||
(db:renumber-timeline-message-index timeline folder :account-id nil))
|
||||
(push-event refresh-event)
|
||||
(notify "Poll fetched"))))
|
||||
(defun fetch-expired-poll-from-notification (notifications)
|
||||
(a:when-let ((polls (remove-if-not (lambda (a) (eq (tooter:kind a)
|
||||
:poll))
|
||||
notifications)))
|
||||
(loop for poll in polls do
|
||||
(let* ((timeline (thread-window:timeline-type *thread-window*))
|
||||
(folder (thread-window:timeline-folder *thread-window*))
|
||||
(status (tooter:status poll))
|
||||
(status-id (tooter:id status))
|
||||
(refresh-event (make-instance 'refresh-thread-windows-event
|
||||
:priority +minimum-event-priority+
|
||||
:message-status-id status-id)))
|
||||
(notify "Fetching expired poll")
|
||||
(program-events:with-enqueued-process ()
|
||||
(db:update-db (api-client:get-remote-status status-id)
|
||||
:folder folder
|
||||
:timeline timeline
|
||||
:skip-ignored-p nil)
|
||||
(db:renumber-timeline-message-index timeline folder :account-id nil))
|
||||
(push-event refresh-event)
|
||||
(notify "Poll fetched")))))
|
||||
|
||||
(hooks:add-hook 'hooks:*after-getting-fediverse-notification*
|
||||
(hooks:add-hook 'hooks:*after-getting-all-fediverse-notifications*
|
||||
#'fetch-expired-poll-from-notification)
|
||||
|
|
|
@ -866,6 +866,8 @@ the latest 15 mentions)."
|
|||
(when notifications
|
||||
(%notifications)))))
|
||||
(%notifications)))
|
||||
(hooks:run-hook 'hooks:*after-getting-all-fediverse-notifications*
|
||||
notifications-so-far)
|
||||
notifications-so-far))
|
||||
|
||||
(defun delete-all-notifications (&optional (progress-fn nil))
|
||||
|
|
|
@ -142,3 +142,6 @@ open the links")
|
|||
|
||||
(defparameter *after-getting-fediverse-notification* '()
|
||||
"Run these hooks for each notification got")
|
||||
|
||||
(defparameter *after-getting-all-fediverse-notifications* '()
|
||||
"Run these hooks for all notifications got")
|
||||
|
|
|
@ -1967,7 +1967,8 @@
|
|||
:*after-gemini-request-sent*
|
||||
:*after-titan-socket*
|
||||
:*after-titan-request-sent*
|
||||
:*after-getting-fediverse-notification*))
|
||||
:*after-getting-fediverse-notification*
|
||||
:*after-getting-all-fediverse-notifications*))
|
||||
|
||||
(defpackage :keybindings
|
||||
(:use
|
||||
|
|
Loading…
Reference in New Issue