aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-08-08 17:27:07 +0200
committermousebot <mousebot@riseup.net>2021-08-08 17:27:07 +0200
commit8282ad9e124c5eff70b611613d6f345b6b650000 (patch)
treed09ce64faa81e80e9fe706de310e03a96922cc63 /lisp
parent13ddb9e3a3a7eac72fca95475baad0bd7792b6d9 (diff)
include follow-requests in notifications
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-notifications.el23
1 files changed, 21 insertions, 2 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index a731ddf..676b4a8 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -45,14 +45,16 @@
'(("mention" . mastodon-notifications--mention)
("follow" . mastodon-notifications--follow)
("favourite" . mastodon-notifications--favourite)
- ("reblog" . mastodon-notifications--reblog))
+ ("reblog" . mastodon-notifications--reblog)
+ ("follow_request" . mastodon-notifications--follow-request))
"Alist of notification types and their corresponding function.")
(defvar mastodon-notifications--response-alist
'(("Mentioned" . "you")
("Followed" . "you")
("Favourited" . "your status from")
- ("Boosted" . "your status from"))
+ ("Boosted" . "your status from")
+ ("Follow request" . "requested to follow you"))
"Alist of subjects for notification types.")
(defun mastodon-notifications--byline-concat (message)
@@ -92,6 +94,23 @@
(mastodon-notifications--byline-concat
"Followed"))))
+(defun mastodon-notifications--follow-request (note)
+ "Format for a `follow-request' NOTE."
+ (let ((id (cdr (assoc 'id note)))
+ (status (mastodon-tl--field 'status note))
+ (follower (cdr (assoc 'username (cdr (assoc 'account note))))))
+ (mastodon-notifications--insert-status
+ ;; Using reblog with an empty id will mark this as something
+ ;; non-boostable/non-favable.
+ (cons '(reblog (id . nil)) note)
+ (propertize (format "You have a follow request from... %s" follower)
+ 'face 'default)
+ 'mastodon-tl--byline-author
+ (lambda (_status)
+ (mastodon-notifications--byline-concat
+ "Requested to follow you"))
+ id)))
+
(defun mastodon-notifications--favourite (note)
"Format for a `favourite' NOTE."
(let ((id (cdr (assoc 'id note)))