aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-05-30 21:51:30 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-05-30 21:51:51 +0200
commitcbd1038eaf6fd353dca6edc950180398012da1f5 (patch)
treec645f080ee757e5f00bb6eb6e15421719f0d9d47
parent9196718802e97f7faaf566acdfe7230266abd0de (diff)
add fallback to tl--init*: if no results, try trending statuses. FIX #562
-rw-r--r--lisp/mastodon-tl.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 67e13b6..bbc4b62 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -88,6 +88,7 @@
(autoload 'mastodon-http--get-response "mastodon-http")
(autoload 'mastodon-search--insert-heading "mastodon-search")
(autoload 'mastodon-media--process-full-sized-image-response "mastodon-media")
+(autoload 'mastodon-search--trending-statuses "mastodon-search")
(defvar mastodon-toot--visibility)
(defvar mastodon-toot-mode)
@@ -2053,7 +2054,8 @@ If NOTIFY is \"false\", disable notifications when that user posts.
Can be called to toggle NOTIFY on users already being followed.
LANGS is an array parameters alist of languages to filer user's posts by.
REBLOGS is a boolean string like NOTIFY, enabling or disabling
-display of the user's boosts in your timeline."
+display of the user's boosts in your timeline.
+JSON is a flag arg for `mastodon-http--post'."
(interactive
(list (mastodon-tl--user-handles-get "follow")))
(mastodon-tl--do-if-item
@@ -2894,7 +2896,17 @@ RESPONSE is the data returned from the server by
JSON and http headers, without it just the JSON."
(let ((json (if headers (car response) response)))
(cond ((not json) ; praying this is right here, else try "\n[]"
- (message "Looks like nothing returned from endpoint: %s" endpoint))
+ ;; this means that whatever tl was inited won't load, which is not
+ ;; always wanted, as sometimes you still need the page to load so
+ ;; you can be in eg mastodon-mode, have keymap, search etc.
+ (message "Looks like nothing returned from endpoint: %s" endpoint)
+ ;; if we are a new account, home tl may have nothing, but then
+ ;; this clause means we can never load mastodon.el at all!
+ ;; so as a fallback, load trending statuses:
+ ;; FIXME: this could possibly be a fallback for all timelines not
+ ;; just home?
+ (when (equal endpoint "timelines/home")
+ (mastodon-search--trending-statuses)))
((eq (caar json) 'error)
(user-error "Looks like the server bugged out: \"%s\"" (cdar json)))
(t