1
0
Fork 0

- 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:
cage 2024-09-06 19:08:02 +02:00
parent a4e93f59d3
commit 43eeb4c613
4 changed files with 29 additions and 22 deletions

View File

@ -16,13 +16,14 @@
(in-package :modules)
(defun fetch-expired-poll-from-notification (notification)
(notify "Checking for expired polls.")
(when (eq (tooter:kind notification)
:poll)
(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 notification))
(status (tooter:status poll))
(status-id (tooter:id status))
(refresh-event (make-instance 'refresh-thread-windows-event
:priority +minimum-event-priority+
@ -35,7 +36,7 @@
:skip-ignored-p nil)
(db:renumber-timeline-message-index timeline folder :account-id nil))
(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)

View File

@ -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))

View File

@ -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")

View File

@ -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