diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-09-24 18:28:52 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-09-24 18:28:52 -0500 |
commit | b50ab4778f7765fbc0454f5a67391438d111b9b3 (patch) | |
tree | 2295f38e4c1d23ff6d3c9f661cc31d5faf4b37f9 | |
parent | 3d133d164146878048d703bc608f3ad6f6506ae4 (diff) |
add account limited by admin flag to api + badge
5 files changed, 19 insertions, 24 deletions
diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb index 99df8e913..f3203e450 100644 --- a/app/helpers/stream_entries_helper.rb +++ b/app/helpers/stream_entries_helper.rb @@ -37,7 +37,10 @@ module StreamEntriesHelper def account_badge(account, all: false) content_tag(:div, class: 'roles') do froze = account.local? ? (account&.user.nil? ? true : account.user.disabled?) : account.froze? + limited = account.silenced? || account.force_unlisted? || account.force_sensitive? + roles = [] + roles << content_tag(:div, t('accounts.roles.limited'), class: 'account-role limited') if limited roles << content_tag(:div, t('accounts.roles.froze'), class: 'account-role froze') if froze roles << content_tag(:div, t('accounts.roles.locked'), class: 'account-role locked') if account.locked? roles << content_tag(:div, t('accounts.roles.bot'), class: 'account-role bot') if account.bot? diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js index 4ff5d3b42..cd2618440 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.js @@ -185,6 +185,7 @@ class Header extends ImmutablePureComponent { const displayNameHtml = { __html: account.get('display_name_html') }; const fields = account.get('fields'); + const badge_limited = account.get('limited') ? (<div className='account-role limited'><FormattedMessage id='account.badges.limited' defaultMessage='⏯️ Limited by admin' /></div>) : null; const badge_locked = account.get('locked') ? (<div className='account-role locked'><FormattedMessage id='account.badges.locked' defaultMessage='🔒 Locked' /></div>) : null; const badge_froze = account.get('froze') ? (<div className='account-role froze'><FormattedMessage id='account.badges.froze' defaultMessage='❄️ Frozen by admin' /></div>) : null; const badge_bot = account.get('bot') ? (<div className='account-role bot'><FormattedMessage id='account.badges.bot' defaultMessage='Bot' /></div>) : null; @@ -224,7 +225,7 @@ class Header extends ImmutablePureComponent { <h1> <span dangerouslySetInnerHTML={displayNameHtml} /> <small>@{acct}</small> - <div className='roles'>{badge_admin}{badge_mod}{badge_froze}{badge_locked}{badge_ac}{badge_bot}{badge_gently}{badge_kobold}</div> + <div className='roles'>{badge_admin}{badge_mod}{badge_froze}{badge_locked}{badge_limited}{badge_ac}{badge_bot}{badge_gently}{badge_kobold}</div> </h1> </div> diff --git a/app/javascript/flavours/glitch/styles/accounts.scss b/app/javascript/flavours/glitch/styles/accounts.scss index 846cf02ee..cda4761bf 100644 --- a/app/javascript/flavours/glitch/styles/accounts.scss +++ b/app/javascript/flavours/glitch/styles/accounts.scss @@ -246,6 +246,12 @@ background-color: rgba(lighten($warning-red, 12%), 0.1); border-color: rgba(lighten($warning-red, 12%), 0.5); } + + &.limited { + color: lighten(orange, 12%); + background-color: rgba(lighten(orange, 12%), 0.1); + border-color: rgba(lighten(orange, 12%), 0.5); + } } .account__header__fields { diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index 4cafe27e9..7ea28afd5 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -6,7 +6,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer context :security context_extensions :manually_approves_followers, :featured, :also_known_as, - :moved_to, :property_value, :hashtag, :emoji, :identity_proof, + :moved_to, :property_value, :hashtag, :emoji, :adult_content, :gently, :kobold, :froze, :big attributes :id, :type, :following, :followers, @@ -122,7 +122,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer end def virtual_attachments - object.fields + object.identity_proofs.active + object.fields end def moved_to @@ -169,24 +169,4 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer Formatter.instance.format_field(object.account, object.value) end end - - class AccountIdentityProofSerializer < ActivityPub::Serializer - attributes :type, :name, :signature_algorithm, :signature_value - - def type - 'IdentityProof' - end - - def name - object.provider_username - end - - def signature_algorithm - object.provider - end - - def signature_value - object.token - end - end end diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index afd6a9e4e..509b688db 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -6,7 +6,8 @@ class REST::AccountSerializer < ActiveModel::Serializer attributes :id, :username, :acct, :display_name, :locked, :bot, :created_at, :note, :url, :avatar, :avatar_static, :header, :header_static, :followers_count, :following_count, :statuses_count, :replies, - :adult_content, :gently, :kobold, :role, :froze, :identity, :signature + :adult_content, :gently, :kobold, :role, :froze, :identity, + :limited, :signature has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested? has_many :emojis, serializer: REST::CustomEmojiSerializer @@ -67,6 +68,10 @@ class REST::AccountSerializer < ActiveModel::Serializer object.local? ? (object&.user.nil? ? true : object.user.disabled?) : object.froze? end + def limited + object.silenced? || object.force_unlisted? || object.force_sensitive? + end + def identity return unless object.local? && object&.user.present? object.user.vars['_they:are'] |