aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-12-17 14:00:52 +0100
committermousebot <mousebot@riseup.net>2021-12-17 14:06:00 +0100
commit439d87ecfa8684a5f218ccb3e7c6e1d4566f378b (patch)
treea27a32f4d04fbe43b4d759e355845e8a6b905594 /lisp
parent2826aef3fb36dc960fa377a5e7e3b23cbc146634 (diff)
FIX echo faves in thread view clashing with media help-echo
move help-echo propertizing to author name of byline, in `mastodon-tl--byline-author'. so when we use `goto-next-toot' point is on author and we get the help echo and add the same help-echo to `mastodon-tl--content', but only when in thread view. this ensures the propertizing occurs prior to any image propertizing, when will then only replace the faves propertizing for the image part of the given toot. that way we have help echo for images when we want, and faves count otherwise.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-tl.el44
1 files changed, 28 insertions, 16 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 1cb9863..ff066f4 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -282,7 +282,17 @@ Optionally start from POS."
(image-type-available-p 'imagemagick)
(image-transforms-p)))
(mastodon-media--get-avatar-rendering avatar-url))
- (propertize name 'face 'mastodon-display-name-face)
+ (propertize name
+ 'face 'mastodon-display-name-face
+ 'help-echo
+ ;; echo faves count when point on post author name:
+ ;; which is where --goto-next-toot puts point.
+ ;; 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-to-use)
+ (alist-get 'reblogs_count toot-to-use)
+ (alist-get 'replies_count toot-to-use))))
" ("
(propertize (concat "@" handle)
'face 'mastodon-handle-face
@@ -689,17 +699,30 @@ message is a link which unhides/hides the main body."
"")))
(defun mastodon-tl--content (toot)
- "Retrieve text content from TOOT."
+ "Retrieve text content from TOOT.
+If we are in thread view, the toot content is propertized with
+faves/boosts/replies counts."
(let* ((content (mastodon-tl--field 'content toot))
(reblog (alist-get 'reblog toot))
(poll-p (if reblog
(alist-get 'poll reblog)
(alist-get 'poll toot))))
(concat
+ (propertize
(mastodon-tl--render-text content toot)
- (when poll-p
- (mastodon-tl--get-poll toot))
- (mastodon-tl--media toot))))
+ 'help-echo (when (and mastodon-tl--buffer-spec
+ (string-match-p
+ "context" ; only when thread view
+ (plist-get mastodon-tl--buffer-spec 'endpoint)))
+ ;; 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-to-use)
+ (alist-get 'reblogs_count toot-to-use)
+ (alist-get 'replies_count toot-to-use)))))
+ (when poll-p
+ (mastodon-tl--get-poll toot))
+ (mastodon-tl--media toot))))
(defun mastodon-tl--insert-status (toot body author-byline action-byline)
"Display the content and byline of timeline element TOOT.
@@ -721,17 +744,6 @@ takes a single function. By default it is
(mastodon-tl--byline toot author-byline action-byline))
'toot-id (alist-get 'id toot)
'base-toot-id (mastodon-tl--toot-id toot)
- ;; FIXME this breaks help property of `mastodon-media--get-media-link-rendering'.
- 'help-echo (when (and mastodon-tl--buffer-spec
- (string-match-p
- "context" ; when thread view
- (plist-get mastodon-tl--buffer-spec 'endpoint)))
- ;; 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-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