diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-11-12 17:30:55 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-11-13 10:27:51 +0100 |
commit | 8f15d5c44e4d6fa9c92e7f13bd9b6073fc600411 (patch) | |
tree | dd02d2e1460b91de0d8534a583a96db009adae10 | |
parent | d34fb4179013ae26c23282c11506aeadcfb7c4f7 (diff) |
don't try to load thread if status at point is foll_req
don't try to load thread if status at point is follow notif
-rw-r--r-- | lisp/mastodon-tl.el | 78 |
1 files changed, 41 insertions, 37 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 3f5dd04..48d238c 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1307,43 +1307,47 @@ ID is that of the toot to view." (mastodon-tl--property 'parent-toot))) (mastodon-tl--property 'base-toot-id)) (mastodon-tl--property '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))))) + (type (mastodon-tl--field 'type (mastodon-tl--property 'toot-json)))) + (if (or (string= type "follow_request") + (string= type "follow")) ; no can thread these + (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. |