diff options
author | marty hiatt <martianhiatus@riseup.net> | 2023-10-31 15:57:56 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2023-10-31 15:57:56 +0100 |
commit | f994ae1b71a8e0b0d4d9c9248e0d55d92e6b3d3e (patch) | |
tree | bd1711be30ae4e2063ce3fc5bf9d24711267e5c7 | |
parent | 9a8d24f9fa2b8644ca50191363f16ac3143cfd5e (diff) |
add role badge to profiles. FIX #504.
-rw-r--r-- | lisp/mastodon-profile.el | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index d3b840e..e21c3dd 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -553,6 +553,15 @@ FIELDS means provide a fields vector fetched by other means." (when (not (equal :json-false x)) (setq result x))))) +(defun mastodon-profile--render-roles (roles) + "Return a propertized string of badges for ROLES." + (mapconcat + (lambda (role) + (propertize + (alist-get 'name role) + 'face `(:box t :foreground ,(alist-get 'color role)))) + roles)) + (defun mastodon-profile--make-profile-buffer-for (account endpoint-type update-function &optional no-reblogs headers) "Display profile of ACCOUNT, using ENDPOINT-TYPE and UPDATE-FUNCTION. @@ -603,6 +612,10 @@ HEADERS means also fetch link headers for pagination." (mastodon-profile--image-from-account account 'header_static) "\n" (propertize .display_name 'face 'mastodon-display-name-face) + ;; roles + (when .roles + (concat " " + (mastodon-profile--render-roles .roles))) "\n" (propertize (concat "@" .acct) 'face 'default) (if (equal .locked t) |