aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-12 17:30:55 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-12 17:30:55 +0100
commit32939e5ea4d44b05a4136b9cda64ff3d21728750 (patch)
tree1db25575238fe23f0f3cf0264f0073a3f77cc0d5
parent79158bd0fd0c67aab90f8ae52d4f90b4b167be22 (diff)
don't try to load thread if status at point is foll_req
-rw-r--r--lisp/mastodon-tl.el80
1 files changed, 41 insertions, 39 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index bd2f9d6..355c215 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1297,45 +1297,47 @@ ID is that of the toot to view."
(or id
;; avoid -tl--property here, we don't want to try next toot:
;; this requires that 'base-toot-id always be set:
- (get-text-property (point) 'base-toot-id)
- ))
- (url (mastodon-http--api (format "statuses/%s/context" id)))
- (buffer (format "*mastodon-thread-%s*" id))
- (toot
- ;; refetch current toot in case we just faved/boosted:
- (mastodon-http--get-json
- (mastodon-http--api (concat "statuses/" id))
- :silent))
- (context (mastodon-http--get-json url :silent))
- (marker (make-marker)))
- (if (equal (caar toot) 'error)
- (message "Error: %s" (cdar toot))
- (when (member (alist-get 'type toot) '("reblog" "favourite"))
- (setq toot (alist-get 'status toot)))
- (if (> (+ (length (alist-get 'ancestors context))
- (length (alist-get 'descendants context)))
- 0)
- ;; if we have a thread:
- (progn
- (with-output-to-temp-buffer buffer
- (switch-to-buffer buffer)
- (mastodon-mode)
- (mastodon-tl--set-buffer-spec
- buffer
- (format "statuses/%s/context" id)
- (lambda (_toot) (message "END of thread.")))
- (let ((inhibit-read-only t))
- (mastodon-tl--timeline (alist-get 'ancestors context))
- (goto-char (point-max))
- (move-marker marker (point))
- ;; print re-fetched toot:
- (mastodon-tl--toot toot :detailed-p)
- (mastodon-tl--timeline (alist-get 'descendants context))))
- ;; put point at the toot:
- (goto-char (marker-position marker))
- (mastodon-tl--goto-next-toot))
- ;; else just print the lone toot:
- (mastodon-tl--single-toot id)))))
+ (get-text-property (point) 'base-toot-id)))
+ (type (mastodon-tl--field 'type (mastodon-tl--property 'toot-json))))
+ (if (string= type "follow_request") ; no can thread this
+ (error "No thread")
+ (let* ((url (mastodon-http--api (format "statuses/%s/context" id)))
+ (buffer (format "*mastodon-thread-%s*" id))
+ (toot
+ ;; refetch current toot in case we just faved/boosted:
+ (mastodon-http--get-json
+ (mastodon-http--api (concat "statuses/" id))
+ :silent))
+ (context (mastodon-http--get-json url :silent))
+ (marker (make-marker)))
+ (if (equal (caar toot) 'error)
+ (message "Error: %s" (cdar toot))
+ (when (member (alist-get 'type toot) '("reblog" "favourite"))
+ (setq toot (alist-get 'status toot)))
+ (if (> (+ (length (alist-get 'ancestors context))
+ (length (alist-get 'descendants context)))
+ 0)
+ ;; if we have a thread:
+ (progn
+ (with-output-to-temp-buffer buffer
+ (switch-to-buffer buffer)
+ (mastodon-mode)
+ (mastodon-tl--set-buffer-spec
+ buffer
+ (format "statuses/%s/context" id)
+ (lambda (_toot) (message "END of thread.")))
+ (let ((inhibit-read-only t))
+ (mastodon-tl--timeline (alist-get 'ancestors context))
+ (goto-char (point-max))
+ (move-marker marker (point))
+ ;; print re-fetched toot:
+ (mastodon-tl--toot toot :detailed-p)
+ (mastodon-tl--timeline (alist-get 'descendants context))))
+ ;; put point at the toot:
+ (goto-char (marker-position marker))
+ (mastodon-tl--goto-next-toot))
+ ;; else just print the lone toot:
+ (mastodon-tl--single-toot id)))))))
(defun mastodon-tl--create-filter ()
"Create a filter for a word.