From efe31d5230a0c310bdc1e2d53ca30c8123aaede2 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 30 Aug 2022 23:24:22 +0200 Subject: clear notification(s) functions --- lisp/mastodon-notifications.el | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'lisp') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 0d11fb4..9986ede 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -268,5 +268,33 @@ of the toot responded to." "notifications" 'mastodon-notifications--timeline)) +(defun mastodon-notifications-clear () + "Clear all notifications." + (interactive) + (let ((response + (mastodon-http--post (mastodon-http--api "notifications/clear") + nil nil))) + (mastodon-http--triage + response (lambda () + (when mastodon-tl--buffer-spec + (mastodon-tl--reload-timeline-or-profile)) + (message "All notifications cleared!"))))) + +(defun mastodon-notifications-clear-current-notif () + "Dismiss the notification at point." + (interactive) + (let* ((id (or (mastodon-tl--property 'toot-id) + (mastodon-tl--field 'id + (mastodon-tl--property 'toot-json)))) + (response + (mastodon-http--post (mastodon-http--api + (format "notifications/%s/dismiss" id)) + nil nil))) + (mastodon-http--triage + response (lambda () + (when mastodon-tl--buffer-spec + (mastodon-tl--reload-timeline-or-profile)) + (message "Notification dismissed!"))))) + (provide 'mastodon-notifications) ;;; mastodon-notifications.el ends here -- cgit v1.2.3