branch: elpa/mastodon
commit ba4284635276c4dad6ff3759138596abc4f756aa
Author: marty hiatt <martianhia...@disroot.org>
Commit: marty hiatt <martianhia...@disroot.org>

    notif reqs: add a pending-p predicate fun
---
 lisp/mastodon-notifications.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index ab77861647..6cdeb257ec 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -821,6 +821,13 @@ Status notifications are created when you call
   (let ((url (mastodon-notifications--api "notifications/policy")))
     (mastodon-http--get-json url)))
 
+(defun mastodon-notifications--pending-p ()
+  "Non-nil if there are any pending requests or notifications."
+  (let* ((json (mastodon-notifications--get-policy))
+         (summary (alist-get 'summary json)))
+    (or (not (= 0 (alist-get 'pending_requests_count summary)))
+        (not (= 0 (alist-get 'pending_notifications_count summary))))))
+
 (defun mastodon-notifications--update-policy (&optional params)
   "Update notifications filtering policy.
 PARAMS is an alist of parameters."

Reply via email to