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,13 +16,14 @@
|
||||||
|
|
||||||
(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)))
|
||||||
|
(loop for poll in polls do
|
||||||
(let* ((timeline (thread-window:timeline-type *thread-window*))
|
(let* ((timeline (thread-window:timeline-type *thread-window*))
|
||||||
(folder (thread-window:timeline-folder *thread-window*))
|
(folder (thread-window:timeline-folder *thread-window*))
|
||||||
(status (tooter:status notification))
|
(status (tooter:status poll))
|
||||||
(status-id (tooter:id status))
|
(status-id (tooter:id status))
|
||||||
(refresh-event (make-instance 'refresh-thread-windows-event
|
(refresh-event (make-instance 'refresh-thread-windows-event
|
||||||
:priority +minimum-event-priority+
|
:priority +minimum-event-priority+
|
||||||
|
@ -35,7 +36,7 @@
|
||||||
:skip-ignored-p nil)
|
:skip-ignored-p nil)
|
||||||
(db:renumber-timeline-message-index timeline folder :account-id nil))
|
(db:renumber-timeline-message-index timeline folder :account-id nil))
|
||||||
(push-event refresh-event)
|
(push-event refresh-event)
|
||||||
(notify "Poll fetched"))))
|
(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