aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-notifications.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-12-16 16:09:35 +0100
committermousebot <mousebot@riseup.net>2021-12-16 16:09:35 +0100
commitc06776ba115c561ddb23fd9887aad1c19c5b960a (patch)
treeb11357c0809f2a578541f09a1fa1bea8f031e7db /lisp/mastodon-notifications.el
parentdd9ef80d940655bb24958d3c48a86aad45cefa43 (diff)
parent7653aacf64214fdaf376f4a5b8c7327116da6a90 (diff)
Merge branch 'develop' into echo-faves-in-thread
Diffstat (limited to 'lisp/mastodon-notifications.el')
-rw-r--r--lisp/mastodon-notifications.el26
1 files changed, 24 insertions, 2 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index 4437635..15633be 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -54,7 +54,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
@@ -62,7 +63,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.