Skip to content

Commit

Permalink
Show user roles in profile
Browse files Browse the repository at this point in the history
  • Loading branch information
mkody committed Oct 9, 2022
1 parent 147d643 commit 9110d02
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
Expand Up @@ -270,6 +270,8 @@ class Header extends ImmutablePureComponent {
badge = (<div className='account-role bot'><FormattedMessage id='account.badges.bot' defaultMessage='Bot' /></div>);
} else if (account.get('group')) {
badge = (<div className='account-role group'><FormattedMessage id='account.badges.group' defaultMessage='Group' /></div>);
} else if (account.get('role')) {
badge = (<div className={`account-role user-role-${account.get('role').get('id')}`}>{account.get('role').get('name')}</div>);
} else {
badge = null;
}
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/flavours/glitch/styles/containers.scss
Expand Up @@ -736,9 +736,11 @@
border-top: 1px solid lighten($ui-base-color, 12%);
}

/* im-in-space: Don't hide the roles
.roles {
display: none;
}
*/
}

&__links {
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/mastodon/features/account/components/header.js
Expand Up @@ -277,6 +277,8 @@ class Header extends ImmutablePureComponent {
badge = (<div className='account-role bot'><FormattedMessage id='account.badges.bot' defaultMessage='Bot' /></div>);
} else if (account.get('group')) {
badge = (<div className='account-role group'><FormattedMessage id='account.badges.group' defaultMessage='Group' /></div>);
} else if (account.get('role')) {
badge = (<div className={`account-role user-role-${account.get('role').get('id')}`}>{account.get('role').get('name')}</div>);
} else {
badge = null;
}
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/styles/mastodon/containers.scss
Expand Up @@ -730,9 +730,11 @@
border-top: 1px solid lighten($ui-base-color, 12%);
}

/* im-in-space: Don't hide the roles
.roles {
display: none;
}
*/
}

&__links {
Expand Down
6 changes: 5 additions & 1 deletion app/serializers/rest/account_serializer.rb
Expand Up @@ -4,7 +4,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
include RoutingHelper
include FormattingHelper

attributes :id, :username, :acct, :display_name, :locked, :bot, :discoverable, :group, :created_at,
attributes :id, :username, :acct, :display_name, :locked, :bot, :role, :discoverable, :group, :created_at,
:note, :url, :avatar, :avatar_static, :header, :header_static,
:followers_count, :following_count, :statuses_count, :last_status_at

Expand Down Expand Up @@ -83,6 +83,10 @@ def bot
object.suspended? ? false : object.bot
end

def role
object.suspended? ? false : object.user_role
end

def discoverable
object.suspended? ? false : object.discoverable
end
Expand Down

0 comments on commit 9110d02

Please sign in to comment.