Add admin and moderator badges to user view and make their visibility configurable
Revives: !134 (closed)
Corresponding FE MR pleroma-fe!519 (merged) (currently on hold until the UI decision is made) and screencast: https://cl.ly/31e1431130c4.
BE provides two JSON fields: role
(which can be admin
, moderator
, or default member
) and show_role
. A few notes
-
If the user chooses not to display role, BE doesn't include
role
in the JSON response when giving this user's data to other users. -
show_role
is visible only to current user and is used for toggling the parameter in the user settings UI
Internally, BE uses is_admin
and is_moderator
to provide the role value. I decided to go with this approach and conceal those flags from FE in order to be consistent with rights
implementation which also hides is_admin
and is_moderator
:
"rights" => %{
"delete_others_notice" => !!user.info.is_moderator,
"admin" => !!user.info.is_admin
},
But please let me know what you think, I'm open to suggestions.