aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-notifications.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-12-16 15:19:49 +0100
committermousebot <mousebot@riseup.net>2021-12-16 15:19:49 +0100
commitd451912722766482371ed491de415f1647cf8b9d (patch)
tree9e4752f2cbd48a216f46a5efb536cbdc55b2fcae /lisp/mastodon-notifications.el
parentaf72d4943ad942712ec74a387e79fb1d53e6bee8 (diff)
parenta3dd830e4e7b5eddfc21975506fe5461a36c2a89 (diff)
Merge branch 'develop' into notify-when-post
Diffstat (limited to 'lisp/mastodon-notifications.el')
-rw-r--r--lisp/mastodon-notifications.el98
1 files changed, 49 insertions, 49 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index 19b2d3c..15633be 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -29,22 +29,23 @@
;;; Code:
+(autoload 'mastodon-http--api "mastodon-http.el")
+(autoload 'mastodon-http--post "mastodon-http.el")
+(autoload 'mastodon-http--triage "mastodon-http.el")
(autoload 'mastodon-media--inline-images "mastodon-media.el")
+(autoload 'mastodon-tl--byline "mastodon-tl.el")
(autoload 'mastodon-tl--byline-author "mastodon-tl.el")
(autoload 'mastodon-tl--clean-tabs-and-nl "mastodon-tl.el")
(autoload 'mastodon-tl--content "mastodon-tl.el")
-(autoload 'mastodon-tl--byline "mastodon-tl.el")
-(autoload 'mastodon-tl--toot-id "mastodon-tl.el")
(autoload 'mastodon-tl--field "mastodon-tl.el")
+(autoload 'mastodon-tl--find-property-range "mastodon-tl.el")
(autoload 'mastodon-tl--has-spoiler "mastodon-tl.el")
(autoload 'mastodon-tl--init "mastodon-tl.el")
+(autoload 'mastodon-tl--init-sync "mastodon-tl.el")
(autoload 'mastodon-tl--insert-status "mastodon-tl.el")
-(autoload 'mastodon-tl--spoiler "mastodon-tl.el")
(autoload 'mastodon-tl--property "mastodon-tl.el")
-(autoload 'mastodon-tl--find-property-range "mastodon-tl.el")
-(autoload 'mastodon-http--triage "mastodon-http.el")
-(autoload 'mastodon-http--post "mastodon-http.el")
-(autoload 'mastodon-http--api "mastodon-http.el")
+(autoload 'mastodon-tl--spoiler "mastodon-tl.el")
+(autoload 'mastodon-tl--toot-id "mastodon-tl.el")
(defvar mastodon-tl--display-media-p)
@@ -74,31 +75,30 @@
" "
(cdr (assoc message mastodon-notifications--response-alist))))
-
(defun mastodon-notifications--follow-request-accept-notifs ()
"Accept the follow request of user at point, in notifications view."
(interactive)
(when (mastodon-tl--find-property-range 'toot-json (point))
(let* ((toot-json (mastodon-tl--property 'toot-json))
- (f-req-p (string= "follow_request" (cdr (assoc 'type toot-json)))))
+ (f-req-p (string= "follow_request" (alist-get 'type toot-json))))
(if f-req-p
- (let* ((account (cdr (assoc 'account toot-json)))
- (id (cdr (assoc 'id account)))
- (handle (cdr (assoc 'acct account)))
- (name (cdr (assoc 'username account))))
- (if id
- (let ((response
- (mastodon-http--post
- (concat
- (mastodon-http--api "follow_requests")
- (format "/%s/authorize" id))
- nil nil)))
- (mastodon-http--triage response
- (lambda ()
- (mastodon-notifications--get)
- (message "Follow request of %s (@%s) accepted!"
- name handle))))
- (message "No account result at point?")))
+ (let* ((account (alist-get 'account toot-json))
+ (id (alist-get 'id account))
+ (handle (alist-get 'acct account))
+ (name (alist-get 'username account)))
+ (if id
+ (let ((response
+ (mastodon-http--post
+ (concat
+ (mastodon-http--api "follow_requests")
+ (format "/%s/authorize" id))
+ nil nil)))
+ (mastodon-http--triage response
+ (lambda ()
+ (mastodon-notifications--get)
+ (message "Follow request of %s (@%s) accepted!"
+ name handle))))
+ (message "No account result at point?")))
(message "No follow request at point?")))))
(defun mastodon-notifications--follow-request-reject-notifs ()
@@ -106,30 +106,30 @@
(interactive)
(when (mastodon-tl--find-property-range 'toot-json (point))
(let* ((toot-json (mastodon-tl--property 'toot-json))
- (f-req-p (string= "follow_request" (cdr (assoc 'type toot-json)))))
+ (f-req-p (string= "follow_request" (alist-get 'type toot-json))))
(if f-req-p
- (let* ((account (cdr (assoc 'account toot-json)))
- (id (cdr (assoc 'id account)))
- (handle (cdr (assoc 'acct account)))
- (name (cdr (assoc 'username account))))
- (if id
- (let ((response
- (mastodon-http--post
- (concat
- (mastodon-http--api "follow_requests")
- (format "/%s/reject" id))
- nil nil)))
- (mastodon-http--triage response
- (lambda ()
- (mastodon-notifications--get)
- (message "Follow request of %s (@%s) rejected!"
- name handle))))
- (message "No account result at point?")))
+ (let* ((account (alist-get 'account toot-json))
+ (id (alist-get 'id account))
+ (handle (alist-get 'acct account))
+ (name (alist-get 'username account)))
+ (if id
+ (let ((response
+ (mastodon-http--post
+ (concat
+ (mastodon-http--api "follow_requests")
+ (format "/%s/reject" id))
+ nil nil)))
+ (mastodon-http--triage response
+ (lambda ()
+ (mastodon-notifications--get)
+ (message "Follow request of %s (@%s) rejected!"
+ name handle))))
+ (message "No account result at point?")))
(message "No follow request at point?")))))
(defun mastodon-notifications--mention (note)
"Format for a `mention' NOTE."
- (let ((id (cdr (assoc 'id note)))
+ (let ((id (alist-get 'id note))
(status (mastodon-tl--field 'status note)))
(mastodon-notifications--insert-status
status
@@ -158,8 +158,8 @@
(defun mastodon-notifications--follow-request (note)
"Format for a `follow-request' NOTE."
- (let ((id (cdr (assoc 'id note)))
- (follower (cdr (assoc 'username (cdr (assoc 'account note))))))
+ (let ((id (alist-get 'id note))
+ (follower (alist-get 'username (alist-get 'account note))))
(mastodon-notifications--insert-status
(cons '(reblog (id . nil)) note)
(propertize (format "You have a follow request from... %s" follower)
@@ -172,7 +172,7 @@
(defun mastodon-notifications--favourite (note)
"Format for a `favourite' NOTE."
- (let ((id (cdr (assoc 'id note)))
+ (let ((id (alist-get 'id note))
(status (mastodon-tl--field 'status note)))
(mastodon-notifications--insert-status
status
@@ -190,7 +190,7 @@
(defun mastodon-notifications--reblog (note)
"Format for a `boost' NOTE."
- (let ((id (cdr (assoc 'id note)))
+ (let ((id (alist-get 'id note))
(status (mastodon-tl--field 'status note)))
(mastodon-notifications--insert-status
status