From 5de5012d01de70a2ebed496a90daa60e9b1a8481 Mon Sep 17 00:00:00 2001 From: Alexander Griffith Date: Wed, 7 Mar 2018 18:41:49 -0500 Subject: Fix missing thread notifications (#176) * Print "No Thread\!" if there are no descendants or ancestors. * Fixed errors for Reblog, follow and favourited notifications. --- lisp/mastodon-tl.el | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 9fe58ae..b066608 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -652,18 +652,24 @@ webapp" (buffer (format "*mastodon-thread-%s*" id)) (toot (mastodon-tl--property 'toot-json)) (context (mastodon-http--get-json url))) - (with-output-to-temp-buffer buffer - (switch-to-buffer buffer) - (mastodon-mode) - (setq mastodon-tl--buffer-spec - `(buffer-name ,buffer - endpoint ,(format "statuses/%s/context" id) - update-function - (lambda(toot) (message "END of thread.")))) - (mastodon-tl--timeline (vconcat - (cdr (assoc 'ancestors context)) - `(,toot) - (cdr (assoc 'descendants context))))))) + (when (member (cdr (assoc 'type toot)) '("reblog" "favourite")) + (setq toot (cdr(assoc 'status toot)))) + (if (> (+ (length (cdr (assoc 'ancestors context))) + (length (cdr (assoc 'descendants context)))) + 0) + (with-output-to-temp-buffer buffer + (switch-to-buffer buffer) + (mastodon-mode) + (setq mastodon-tl--buffer-spec + `(buffer-name ,buffer + endpoint ,(format "statuses/%s/context" id) + update-function + (lambda(toot) (message "END of thread.")))) + (mastodon-tl--timeline (vconcat + (cdr (assoc 'ancestors context)) + `(,toot) + (cdr (assoc 'descendants context))))) + (message "No Thread!")))) (defun mastodon-tl--more () "Append older toots to timeline." -- cgit v1.2.3