From d5bab484a7f8593e095ff0fc97e903a38c62c951 Mon Sep 17 00:00:00 2001 From: Holger Dürer Date: Sat, 6 Nov 2021 16:31:01 +0100 Subject: Simplify the logic in `mastodon-tl--insert-status`. Just a small simplification of the recent change from commit 027f24125f: the formatting is actually the same no matter if showing infos about the toot itself or the reblogged toot, so let's just first pick which toot to use and have the formatting just once. --- lisp/mastodon-tl.el | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index cf1c326..62d283b 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -724,15 +724,12 @@ takes a single function. By default it is (string-match-p "context" ; when thread view (plist-get mastodon-tl--buffer-spec 'endpoint))) - (if-let ((reblog (alist-get 'reblog toot))) - (format "%s faves | %s boosts | %s replies" - (alist-get 'favourites_count reblog) - (alist-get 'reblogs_count reblog) - (alist-get 'replies_count reblog)) + ;; prefer the reblog toot if present: + (let ((toot-to-use (or (alist-get 'reblog toot) toot))) (format "%s faves | %s boosts | %s replies" - (alist-get 'favourites_count toot) - (alist-get 'reblogs_count toot) - (alist-get 'replies_count toot)))) + (alist-get 'favourites_count toot-to-use) + (alist-get 'reblogs_count toot-to-use) + (alist-get 'replies_count toot-to-use)))) 'toot-json toot) "\n") (when mastodon-tl--display-media-p -- cgit v1.2.3