diff options
author | mousebot <mousebot@riseup.net> | 2021-11-02 15:24:28 +0100 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2021-11-02 15:24:28 +0100 |
commit | 18c146170a21dccd576228b1c6e3bcba9f0d50e9 (patch) | |
tree | 5f224cab55da7f41da958988eb6eca86cecc7047 /lisp/mastodon-notifications.el | |
parent | 04465567450d6fc9cdec1a1ba0ef12557b0ab54b (diff) |
add support for receiving notifications when a user posts
- mastodon-tl--notify-user-posts
- mastodon-tl--no-notify-user-posts
- + some schtick in notifications.el to make sure the notifs display ok.
Diffstat (limited to 'lisp/mastodon-notifications.el')
-rw-r--r-- | lisp/mastodon-notifications.el | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 2e9aea3..19b2d3c 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -53,7 +53,8 @@ ("follow" . mastodon-notifications--follow) ("favourite" . mastodon-notifications--favourite) ("reblog" . mastodon-notifications--reblog) - ("follow_request" . mastodon-notifications--follow-request)) + ("follow_request" . mastodon-notifications--follow-request) + ("status" . mastodon-notifications--status)) "Alist of notification types and their corresponding function.") (defvar mastodon-notifications--response-alist @@ -61,7 +62,8 @@ ("Followed" . "you") ("Favourited" . "your status from") ("Boosted" . "your status from") - ("Requested to follow" . "you")) + ("Requested to follow" . "you") + ("Posted" . "a post")) "Alist of subjects for notification types.") (defun mastodon-notifications--byline-concat (message) @@ -204,6 +206,26 @@ "Boosted")) id))) +(defun mastodon-notifications--status (note) + "Format for a `status' NOTE. +Status notifications are given when +`mastodon-tl--notify-user-posts' has been set." + (let ((id (cdr (assoc 'id note))) + (status (mastodon-tl--field 'status note))) + (mastodon-notifications--insert-status + status + (mastodon-tl--clean-tabs-and-nl + (if (mastodon-tl--has-spoiler status) + (mastodon-tl--spoiler status) + (mastodon-tl--content status))) + (lambda (_status) + (mastodon-tl--byline-author + note)) + (lambda (_status) + (mastodon-notifications--byline-concat + "Posted")) + id))) + (defun mastodon-notifications--insert-status (toot body author-byline action-byline &optional id) "Display the content and byline of timeline element TOOT. |