aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-notifications.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-09 19:21:32 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-09 19:21:32 +0200
commit32225214c8de7d659af07eba4250fed96c6af852 (patch)
tree27b14d9bdb11b0afb6a652cfa31a5cabcacfb5c8 /lisp/mastodon-notifications.el
parent2bdbb602059bd1d0114ecd560b87c12d184ff437 (diff)
let-alist follow-request-process
Diffstat (limited to 'lisp/mastodon-notifications.el')
-rw-r--r--lisp/mastodon-notifications.el45
1 files changed, 20 insertions, 25 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index bed2d9a..b402f2a 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -108,31 +108,26 @@ follow-requests view."
(plist-get mastodon-tl--buffer-spec 'endpoint)))
(f-req-p (or (string= "follow_request" (alist-get 'type toot-json)) ;notifs
f-reqs-view-p)))
- (if f-req-p
- (let* ((account (or (alist-get 'account toot-json) ;notifs
- toot-json)) ;f-reqs
- (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/%s" id (if reject
- "reject"
- "authorize"))))))
- (mastodon-http--triage response
- (lambda ()
- (if f-reqs-view-p
- (mastodon-views--view-follow-requests)
- (mastodon-tl--reload-timeline-or-profile))
- (message "Follow request of %s (@%s) %s!"
- name handle (if reject
- "rejected"
- "accepted")))))
- (message "No account result at point?")))
- (message "No follow request at point?")))))
+ (if (not f-req-p)
+ (message "No follow request at point?")
+ (let-alist (or (alist-get 'account toot-json) ;notifs
+ toot-json) ;f-reqs
+ (if .id
+ (let ((response
+ (mastodon-http--post
+ (concat
+ (mastodon-http--api "follow_requests")
+ (format "/%s/%s" .id (if reject "reject" "authorize"))))))
+ (mastodon-http--triage response
+ (lambda ()
+ (if f-reqs-view-p
+ (mastodon-views--view-follow-requests)
+ (mastodon-tl--reload-timeline-or-profile))
+ (message "Follow request of %s (@%s) %s!"
+ .username .acct (if reject
+ "rejected"
+ "accepted")))))
+ (message "No account result at point?")))))))
(defun mastodon-notifications--follow-request-accept ()
"Accept a follow request.