From bd9710c355093259ec8a8cad8572a2b387aa631a Mon Sep 17 00:00:00 2001 From: mousebot Date: Fri, 11 Mar 2022 12:16:13 +0100 Subject: fix follow etc user when point on profile header info we just modify the if test to not run in accounts buffers, which means we end up using the next-toot solution, as was originally the case. hopefully a profile view will always have a toot or user or sth. else we cd find a better solution --- lisp/mastodon-tl.el | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index e517397..919bbbb 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1262,16 +1262,18 @@ Can be called to toggle NOTIFY on users already being followed." (interactive (list (mastodon-tl--interactive-user-handles-get "follow"))) - (if (not (get-text-property (point) 'toot-json)) + (if (and (not (string-prefix-p "accounts" (mastodon-tl--get-endpoint))) ;profile view + (not (get-text-property (point) 'toot-json))) (message "Looks like there's no toot or user at point?") - (mastodon-tl--do-user-action-and-response user-handle "follow" nil notify))) + (mastodon-tl--do-user-action-and-response user-handle "follow" nil notify))) (defun mastodon-tl--enable-notify-user-posts (user-handle) "Query for USER-HANDLE and enable notifications when they post." (interactive (list (mastodon-tl--interactive-user-handles-get "enable"))) - (if (not (get-text-property (point) 'toot-json)) + (if (and (not (string-prefix-p "accounts" (mastodon-tl--get-endpoint))) ;profile view + (not (get-text-property (point) 'toot-json))) (message "Looks like there's no toot or user at point?") (mastodon-tl--follow-user user-handle "true"))) @@ -1287,18 +1289,20 @@ Can be called to toggle NOTIFY on users already being followed." (interactive (list (mastodon-tl--interactive-user-handles-get "unfollow"))) - (if (not (get-text-property (point) 'toot-json)) + (if (and (not (string-prefix-p "accounts" (mastodon-tl--get-endpoint))) ;profile view + (not (get-text-property (point) 'toot-json))) (message "Looks like there's no toot or user at point?") - (mastodon-tl--do-user-action-and-response user-handle "unfollow" t))) + (mastodon-tl--do-user-action-and-response user-handle "unfollow" t))) (defun mastodon-tl--block-user (user-handle) "Query for USER-HANDLE from current status and block that user." (interactive (list (mastodon-tl--interactive-user-handles-get "block"))) - (if (not (get-text-property (point) 'toot-json)) + (if (and (not (string-prefix-p "accounts" (mastodon-tl--get-endpoint))) ;profile view + (not (get-text-property (point) 'toot-json))) (message "Looks like there's no toot or user at point?") - (mastodon-tl--do-user-action-and-response user-handle "block"))) + (mastodon-tl--do-user-action-and-response user-handle "block"))) (defun mastodon-tl--unblock-user (user-handle) "Query for USER-HANDLE from list of blocked users and unblock that user." @@ -1314,9 +1318,10 @@ Can be called to toggle NOTIFY on users already being followed." (interactive (list (mastodon-tl--interactive-user-handles-get "mute"))) - (if (not (get-text-property (point) 'toot-json)) + (if (and (not (string-prefix-p "accounts" (mastodon-tl--get-endpoint))) ;profile view + (not (get-text-property (point) 'toot-json))) (message "Looks like there's no toot or user at point?") - (mastodon-tl--do-user-action-and-response user-handle "mute"))) + (mastodon-tl--do-user-action-and-response user-handle "mute"))) (defun mastodon-tl--unmute-user (user-handle) "Query for USER-HANDLE from list of muted users and unmute that user." @@ -1329,7 +1334,8 @@ Can be called to toggle NOTIFY on users already being followed." (defun mastodon-tl--interactive-user-handles-get (action) "Get the list of user-handles for ACTION from the current toot." - (if (not (get-text-property (point) 'toot-json)) + (if (and (not (string-prefix-p "accounts" (mastodon-tl--get-endpoint))) ;profile view + (not (get-text-property (point) 'toot-json))) (message "Looks like there's no toot or user at point?") (let ((user-handles (cond ((or (equal (buffer-name) "*mastodon-follow-suggestions*") -- cgit v1.2.3