diff options
author | Holger Dürer <me@hdurer.net> | 2021-11-06 16:31:01 +0100 |
---|---|---|
committer | Holger Dürer <me@hdurer.net> | 2021-11-06 16:31:01 +0100 |
commit | d5bab484a7f8593e095ff0fc97e903a38c62c951 (patch) | |
tree | 52779083785878b701229e070153516453939fa3 | |
parent | 6f0afbb8b46f3d5efa02f4f6ecd4d2a216d9bb21 (diff) |
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.
-rw-r--r-- | lisp/mastodon-tl.el | 13 |
1 files changed, 5 insertions, 8 deletions
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 |