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

    render profile migration data as link to new profile. FIX #699.
---
 lisp/mastodon-profile.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 177179fdf1..c603ee4d94 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -636,6 +636,22 @@ FIELDS means provide a fields vector fetched by other 
means."
                  'face `(:box t :foreground ,(alist-get 'color role))))
    roles))
 
+(defun mastodon-profile--render-moved (data)
+  "Return a propertized string of a migrated account link.
+DATA is an account data from a moved field in profile data."
+  (let-alist data
+    (let ((handle (concat "@" .acct)))
+      (concat
+       "this account has migrated to: "
+       (mastodon-tl--buttonify-link
+        handle
+        'face 'shr-link ;'mastodon-handle-face
+        'mastodon-tab-stop 'user-handle
+        'shr-url .url
+        'mastodon-handle handle
+        'help-echo (concat "Browse user profile of " handle))
+       "\n\n"))))
+
 (defun mastodon-profile--make-profile-buffer-for
     (account endpoint-type update-function
              &optional no-reblogs headers no-replies only-media tag max-id)
@@ -703,6 +719,9 @@ MAX-ID is a flag to include the max_id pagination 
parameter."
              (when (eq .locked t)
                (concat " " (mastodon-tl--symbol 'locked)))
              "\n " mastodon-tl--horiz-bar "\n"
+             ;; migration:
+             (when .moved
+               (mastodon-profile--render-moved .moved))
              ;; profile note:
              (mastodon-tl--render-text .note account) ; account = tab-stops in 
profile
              ;; meta fields:

Reply via email to