diff options
author | Johnson Denen <johnson.denen@gmail.com> | 2017-04-18 10:33:24 -0400 |
---|---|---|
committer | Johnson Denen <johnson.denen@gmail.com> | 2017-04-18 10:44:40 -0400 |
commit | 27d152d85d9e26dc3080dfabb155980b22405c3f (patch) | |
tree | 283c4a047287ac5fa7830bea6459aa301a282607 /lisp/mastodon-toot.el | |
parent | 35a896aaf700e68f92883e93ce4cc4c3d1196ae6 (diff) |
Show boosted state with (B) marker in byline
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r-- | lisp/mastodon-toot.el | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index d677f5d..e567cc6 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -61,7 +61,23 @@ STATUS is passed by `url-retrieve'." (interactive) (kill-buffer-and-window)) -;; TODO extract success callback +(defun mastodon-toot--action-success (marker) + "Insert MARKER with 'success face in byline." + (let ((inhibit-read-only t)) + (mastodon-tl--property 'toot-id) + (goto-char (+ 3 (point))) + (insert (format "(%s) " + (propertize marker + 'face 'success))))) + +(defun mastodon-toot--boost-triage (response) + "Parse response code from RESPONSE buffer." + (let ((status (with-current-buffer response + (mastodon--response-code)))) + (if (string-prefix-p "2" status) + (mastodon-toot--action-success "B") + (switch-to-buffer response)))) + (defun mastodon-toot--boost () "Boost toot at point." (interactive) @@ -70,10 +86,7 @@ STATUS is passed by `url-retrieve'." (number-to-string id) "/reblog")))) (let ((response (mastodon-http--post url nil nil))) - (with-current-buffer response - (if (string-prefix-p "2" (mastodon--response-code)) - (message "Boosted!") - (switch-to-buffer response)))))) + (mastodon-toot--boost-triage response)))) (defvar mastodon-toot-mode-map (let ((map (make-sparse-keymap))) |