diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-08-30 23:24:22 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-08-30 23:24:22 +0200 |
commit | efe31d5230a0c310bdc1e2d53ca30c8123aaede2 (patch) | |
tree | 58b530a6b7023412c90fc5ade4aae76a4d7f80da /lisp | |
parent | b4c8bcfbbf776783b11644f8917409d143d84962 (diff) |
clear notification(s) functions
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-notifications.el | 28 |
1 files changed, 28 insertions, 0 deletions
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 |