aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-12-24 15:10:19 +0100
committermousebot <mousebot@riseup.net>2021-12-24 15:10:19 +0100
commita56e2bfcaaa7706a2b27656413170c83bffa6ef0 (patch)
tree75353e750c6cf413b1aa46e12a37bfa8e1ef11f7 /lisp/mastodon-tl.el
parentd544d6774542afe82ab4b513c7d3717e9d692efc (diff)
refactor mastodon-notifications--insert-status
which was a copy of mastodon-tl--insert-status. we revert to having just the latter as main function with optional argument. mastodon-notifications--insert-status just calls it with the arg ID. the reason we need the difference is to ensure notifications have their own ID, and not that of the toot the notif refers to, attached as property "toot-id". then we have all functionality working on notifications, such as boosting mentions and so on.
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index b2b8026..87b8dfc 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -734,7 +734,7 @@ Runs `mastodon-tl--render-text' and fetches poll or media."
(mastodon-tl--get-poll toot))
(mastodon-tl--media toot))))
-(defun mastodon-tl--insert-status (toot body author-byline action-byline)
+(defun mastodon-tl--insert-status (toot body author-byline action-byline &optional id)
"Display the content and byline of timeline element TOOT.
BODY will form the section of the toot above the byline.
@@ -744,7 +744,10 @@ portion of the byline that takes one variable. By default it is
ACTION-BYLINE is also an optional function for adding an action,
such as boosting favouriting and following to the byline. It also
takes a single function. By default it is
-`mastodon-tl--byline-boosted'"
+`mastodon-tl--byline-boosted'.
+
+ID is that of the toot, which is attached as a property if it is
+a notification."
(let ((start-pos (point)))
(insert
(propertize
@@ -752,7 +755,8 @@ takes a single function. By default it is
body
" \n"
(mastodon-tl--byline toot author-byline action-byline))
- 'toot-id (alist-get 'id toot)
+ 'toot-id (or id ; for notifications
+ (alist-get 'id toot))
'base-toot-id (mastodon-tl--toot-id toot)
'toot-json toot)
"\n")