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)
|
(in-package :modules)
|
||||||
|
|
||||||
(defun fetch-expired-poll-from-notification (notification)
|
(defun fetch-expired-poll-from-notification (notifications)
|
||||||
(notify "Checking for expired polls.")
|
(a:when-let ((polls (remove-if-not (lambda (a) (eq (tooter:kind a)
|
||||||
(when (eq (tooter:kind notification)
|
:poll))
|
||||||
:poll)
|
notifications)))
|
||||||
(let* ((timeline (thread-window:timeline-type *thread-window*))
|
(loop for poll in polls do
|
||||||
(folder (thread-window:timeline-folder *thread-window*))
|
(let* ((timeline (thread-window:timeline-type *thread-window*))
|
||||||
(status (tooter:status notification))
|
(folder (thread-window:timeline-folder *thread-window*))
|
||||||
(status-id (tooter:id status))
|
(status (tooter:status poll))
|
||||||
(refresh-event (make-instance 'refresh-thread-windows-event
|
(status-id (tooter:id status))
|
||||||
:priority +minimum-event-priority+
|
(refresh-event (make-instance 'refresh-thread-windows-event
|
||||||
:message-status-id status-id)))
|
:priority +minimum-event-priority+
|
||||||
(notify "Fetching expired poll")
|
:message-status-id status-id)))
|
||||||
(program-events:with-enqueued-process ()
|
(notify "Fetching expired poll")
|
||||||
(db:update-db (api-client:get-remote-status status-id)
|
(program-events:with-enqueued-process ()
|
||||||
:folder folder
|
(db:update-db (api-client:get-remote-status status-id)
|
||||||
:timeline timeline
|
:folder folder
|
||||||
:skip-ignored-p nil)
|
:timeline timeline
|
||||||
(db:renumber-timeline-message-index timeline folder :account-id nil))
|
:skip-ignored-p nil)
|
||||||
(push-event refresh-event)
|
(db:renumber-timeline-message-index timeline folder :account-id nil))
|
||||||
(notify "Poll fetched"))))
|
(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)
|
#'fetch-expired-poll-from-notification)
|
||||||
|
|
|
@ -866,6 +866,8 @@ the latest 15 mentions)."
|
||||||
(when notifications
|
(when notifications
|
||||||
(%notifications)))))
|
(%notifications)))))
|
||||||
(%notifications)))
|
(%notifications)))
|
||||||
|
(hooks:run-hook 'hooks:*after-getting-all-fediverse-notifications*
|
||||||
|
notifications-so-far)
|
||||||
notifications-so-far))
|
notifications-so-far))
|
||||||
|
|
||||||
(defun delete-all-notifications (&optional (progress-fn nil))
|
(defun delete-all-notifications (&optional (progress-fn nil))
|
||||||
|
|
|
@ -142,3 +142,6 @@ open the links")
|
||||||
|
|
||||||
(defparameter *after-getting-fediverse-notification* '()
|
(defparameter *after-getting-fediverse-notification* '()
|
||||||
"Run these hooks for each notification got")
|
"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-gemini-request-sent*
|
||||||
:*after-titan-socket*
|
:*after-titan-socket*
|
||||||
:*after-titan-request-sent*
|
:*after-titan-request-sent*
|
||||||
:*after-getting-fediverse-notification*))
|
:*after-getting-fediverse-notification*
|
||||||
|
:*after-getting-all-fediverse-notifications*))
|
||||||
|
|
||||||
(defpackage :keybindings
|
(defpackage :keybindings
|
||||||
(:use
|
(:use
|
||||||
|
|
Loading…
Reference in New Issue