branch: elpa/mastodon
commit 0d83e87207ddbaa70d207155690a3e15f438689c
Author: marty hiatt <martianhia...@disroot.org>
Commit: marty hiatt <martianhia...@disroot.org>

    add mastodon-tl-return, RET on foll reqs/folls loads profiles. FIX #713
---
 lisp/mastodon-tl.el | 13 +++++++++++++
 lisp/mastodon.el    |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index a04e06cfff..131f97c6e4 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2486,6 +2486,19 @@ view all branches of a thread."
     (let ((id (mastodon-tl--property 'base-item-id)))
       (mastodon-tl--thread-do id))))
 
+(defun mastodon-tl-return ()
+  "Load user profile or thread of item at point.
+If item at point is a follow or follow request, load user profile.
+Else load thread."
+  (interactive)
+  (let ((notif (mastodon-tl--property 'notification-type)))
+    (if (or (equal "follow" notif)
+            (equal "follow_request" notif))
+        (let* ((json (mastodon-tl--property 'item-json))
+               (handle (alist-get 'acct json)))
+          (mastodon-profile-show-user handle))
+      (mastodon-tl-thread))))
+
 (defun mastodon-tl-thread ()
   "Open thread buffer for toot at point."
   (interactive)
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index 7e797fec4c..d033952eba 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -257,7 +257,7 @@ Also nil `mastodon-auth--token-alist'."
     (define-key map (kbd "v")      #'mastodon-tl-poll-vote)
     (define-key map (kbd "E")      #'mastodon-toot-view-toot-edits)
     (define-key map (kbd "T")      #'mastodon-tl-thread)
-    (define-key map (kbd "RET")    #'mastodon-tl-thread)
+    (define-key map (kbd "RET")    #'mastodon-tl-return)
     (define-key map (kbd "m")      #'mastodon-tl-dm-user)
     (define-key map (kbd "=")      #'mastodon-tl-view-first-full-image)
     (when (require 'lingva nil :no-error)

Reply via email to