branch: elpa/mastodon
commit 1459d63820739276dc2273a378c614b30145ff03
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>
notifs: message in notifs view if new filtered notifs. #653
---
lisp/mastodon-notifications.el | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index 5730a95e08..678493ddad 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -632,6 +632,13 @@ UPDATE means we are updating, so skip some things."
(mastodon-notifications--get-type value)))
:newline)
(insert "\n"))
+ ;; filtered/requests message:
+ (when (mastodon-notifications--notif-requests)
+ (insert
+ (substitute-command-keys
+ "You have filtered notifications. \
+\\[mastodon-notifications--requests] to view requests.\n\n")))
+ ;; render:
(mastodon-notifications--render json
(not mastodon-group-notifications))
(goto-char (point-min))
@@ -821,10 +828,17 @@ Status notifications are created when you call
(defun mastodon-notifications--get-policy ()
"Return the notification filtering policy."
- (interactive)
(let ((url (mastodon-notifications--api "notifications/policy")))
(mastodon-http--get-json url)))
+(defun mastodon-notifications--notif-requests ()
+ "Non-nil if the user currently has pending/filtered notifications.
+Returns"
+ (let* ((policy (mastodon-notifications--get-policy))
+ (count (map-nested-elt policy '(summary
pending_notifications_count))))
+ (if (and count (> count 0))
+ count)))
+
(defun mastodon-notifications--pending-p ()
"Non-nil if there are any pending requests or notifications."
(let* ((json (mastodon-notifications--get-policy))