aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authorJohnson Denen <johnson.denen@gmail.com>2017-04-25 13:19:27 -0400
committerJohnson Denen <johnson.denen@gmail.com>2017-04-27 16:04:28 -0400
commitc694b7b2ef6d673125cbdb1985ccfe31762e0caf (patch)
tree20cefd151f5504cb309ee59a88c6c970f65f8160 /lisp/mastodon-toot.el
parentc81c647c18906445f0a22299613fa4ec27c09caa (diff)
Parity with non-toggle favourite function
TODOs: - Boost/unboost toggle function - Store 'favourite-p property on toots
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 2da6cec..104df1c 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -62,15 +62,16 @@ Remove MARKER if RM is non-nil."
(let ((response (mastodon-http--post url nil nil)))
(mastodon-http--triage response callback))))
-(defun mastodon-toot--toggle-favourite (faved)
+(defun mastodon-toot--toggle-favourite ()
"Favourite/unfavourite toot based on current state.
If FAVED is nil, favourite the toot.
If FAVED is non-nil, unfavourite the toot."
(interactive)
- (let ((action (if faved "unfavourite" "favourite"))
- (remove (when faved t))
- (id (mastodon-tl--property 'toot-id)))
+ (let* ((id (mastodon-tl--property 'toot-id))
+ (faved (get-text-property (point) 'favourite-p))
+ (action (if faved "unfavourite" "favourite"))
+ (remove (when faved t)))
(mastodon-toot--action action (lambda () (mastodon-toot--action-success "F" remove)))
(message (format "%sd #%s" action id))))