aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-notifications.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-17 12:10:42 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-17 12:10:42 +0100
commit325644ad5a155d35e89fd9516b578993481807e5 (patch)
tree42efd7ad2d251c00bf12cea913e279f5e74658cc /lisp/mastodon-notifications.el
parent5e71d81fe698badab960df2f6b46b89c4b6744d7 (diff)
parent0996c7eabfd89e6bb5fa3c9f2558c9d6ac23a44b (diff)
Merge branch 'mentions-view' into develop
Diffstat (limited to 'lisp/mastodon-notifications.el')
-rw-r--r--lisp/mastodon-notifications.el38
1 files changed, 26 insertions, 12 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index f05e670..27b01c1 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -52,25 +52,26 @@
(autoload 'mastodon-tl--reload-timeline-or-profile "mastodon-tl")
(defvar mastodon-tl--buffer-spec)
(defvar mastodon-tl--display-media-p)
+(defvar mastodon-mode-map)
(defvar mastodon-notifications--types-alist
- '(("mention" . mastodon-notifications--mention)
- ("follow" . mastodon-notifications--follow)
+ '(("follow" . mastodon-notifications--follow)
("favourite" . mastodon-notifications--favourite)
("reblog" . mastodon-notifications--reblog)
+ ("mention" . mastodon-notifications--mention)
+ ("poll" . mastodon-notifications--poll)
("follow_request" . mastodon-notifications--follow-request)
- ("status" . mastodon-notifications--status)
- ("poll" . mastodon-notifications--poll))
+ ("status" . mastodon-notifications--status))
"Alist of notification types and their corresponding function.")
(defvar mastodon-notifications--response-alist
- '(("Mentioned" . "you")
- ("Followed" . "you")
+ '(("Followed" . "you")
("Favourited" . "your status from")
("Boosted" . "your status from")
+ ("Mentioned" . "you")
+ ("Posted a poll" . "that has now ended")
("Requested to follow" . "you")
- ("Posted" . "a post")
- ("Posted a poll" . "that has now ended"))
+ ("Posted" . "a post"))
"Alist of subjects for notification types.")
(defvar mastodon-notifications--map
@@ -139,7 +140,7 @@ Can be called in notifications view or in follow-requests view."
"Reject a follow request.
Can be called in notifications view or in follow-requests view."
(interactive)
- (mastodon-notifications--follow-request-process t))
+ (mastodon-notifications--follow-request-process :reject))
(defun mastodon-notifications--mention (note)
"Format for a `mention' NOTE."
@@ -267,16 +268,29 @@ of the toot responded to."
(mapc #'mastodon-notifications--by-type json)
(goto-char (point-min))))
-(defun mastodon-notifications--get ()
- "Display NOTIFICATIONS in buffer."
+(defun mastodon-notifications--get (&optional type)
+ "Display NOTIFICATIONS in buffer.
+Optionally only print notifications of type TYPE, a string."
(interactive)
(message "Loading your notifications...")
(mastodon-tl--init-sync
"notifications"
"notifications"
- 'mastodon-notifications--timeline)
+ 'mastodon-notifications--timeline
+ type)
(use-local-map mastodon-notifications--map))
+(defun mastodon-notifications--get-mentions ()
+ "Display mention notifications in buffer."
+ (interactive)
+ (mastodon-notifications--get "mention"))
+
+(defun mastodon-notifications--filter-types-list (type)
+ "Return a list of notification types with TYPE (and \"status\") removed."
+ (let ((types (remove "status"
+ (mapcar #'car mastodon-notifications--types-alist))))
+ (remove type types)))
+
(defun mastodon-notifications--clear-all ()
"Clear all notifications."
(interactive)