diff options
author | Holger Durer <hdurer@google.com> | 2018-04-03 18:05:22 +0100 |
---|---|---|
committer | Johnson Denen <johnson.denen@gmail.com> | 2018-08-10 22:20:04 -0400 |
commit | 58afa3e24527c0dafeef669c285ac8ab11e3a42e (patch) | |
tree | ac3a33ff339dd6f9b00b29d04a68c2059f0e63ec /lisp/mastodon-toot.el | |
parent | 4570c441aa71d0f4302f2206a0e328d7ada80eee (diff) |
Fix the boosting/favouriting of statuses in profiles.
(Favouriting itself is still hard since we have clobbered the 'f' keybinding, but if you bind it to something else or invoke it via `M-x mastodon-toot--toggle-favourite` then at least it works.)
This also changes the regular boosting/favoriting behavior. Before we would boost/fav a boost or fav instead of the actual toot that was boosted/faved. With this change we always boost/fav the base toot.
To do this we now keep a second toot id (with the base toot) in the byline's properities. (For regular statuses 'toot-id and 'base-toot-id will be identical.)
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r-- | lisp/mastodon-toot.el | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 9491d2a..c21e5b6 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -40,6 +40,7 @@ (autoload 'mastodon-tl--field "mastodon-tl") (autoload 'mastodon-tl--goto-next-toot "mastodon-tl") (autoload 'mastodon-tl--property "mastodon-tl") +(autoload 'mastodon-tl--find-property-range "mastodon-tl") (autoload 'mastodon-toot "mastodon") (defvar mastodon-toot--reply-to-id nil @@ -77,7 +78,7 @@ Remove MARKER if REMOVE is non-nil, otherwise add it." (defun mastodon-toot--action (action callback) "Take ACTION on toot at point, then execute CALLBACK." - (let* ((id (mastodon-tl--property 'toot-id)) + (let* ((id (mastodon-tl--property 'base-toot-id)) (url (mastodon-http--api (concat "statuses/" (mastodon-tl--as-string id) "/" @@ -90,7 +91,7 @@ Remove MARKER if REMOVE is non-nil, otherwise add it." (interactive) (let* ((byline-region (mastodon-tl--find-property-range 'byline (point))) (id (when byline-region - (mastodon-tl--as-string (mastodon-tl--property 'toot-id)))) + (mastodon-tl--as-string (mastodon-tl--property 'base-toot-id)))) (boosted (when byline-region (get-text-property (car byline-region) 'boosted-p))) (action (if boosted "unreblog" "reblog")) @@ -114,7 +115,7 @@ Remove MARKER if REMOVE is non-nil, otherwise add it." (interactive) (let* ((byline-region (mastodon-tl--find-property-range 'byline (point))) (id (when byline-region - (mastodon-tl--as-string (mastodon-tl--property 'toot-id)))) + (mastodon-tl--as-string (mastodon-tl--property 'base-toot-id)))) (faved (when byline-region (get-text-property (car byline-region) 'favourited-p))) (action (if faved "unfavourite" "favourite")) |