keep `locked` badge for approves-followers + add `frozen` badge for admin-locked accts, also federate `frozen` state
parent
3fda862ea0
commit
6d07ba50f3
|
@ -36,7 +36,9 @@ 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?
|
||||
roles = []
|
||||
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?
|
||||
roles << content_tag(:div, t('accounts.roles.adult'), class: 'account-role adult') if account.adult_content?
|
||||
|
|
|
@ -191,6 +191,7 @@ class Header extends ImmutablePureComponent {
|
|||
const fields = account.get('fields');
|
||||
|
||||
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;
|
||||
const badge_ac = account.get('adult_content') ? (<div className='account-role adult'><FormattedMessage id='account.badges.adult' defaultMessage="🔞 Adult content" /></div>) : null;
|
||||
const badge_gently = account.get('gently') ? (<div className='account-role gently'><FormattedMessage id='account.badges.gently' defaultMessage="Gentlies kobolds" /></div>) : null;
|
||||
|
@ -226,9 +227,10 @@ class Header extends ImmutablePureComponent {
|
|||
|
||||
<div className='account__header__tabs__name'>
|
||||
<h1>
|
||||
<span className='account__header__locked'>{lockedIcon}</span>
|
||||
<span dangerouslySetInnerHTML={displayNameHtml} />
|
||||
<small>@{acct} {lockedIcon}</small>
|
||||
<div className='roles'>{badge_locked}{badge_admin}{badge_mod}{badge_ac}{badge_bot}{badge_gently}{badge_kobold}</div>
|
||||
<small>@{acct}</small>
|
||||
<div className='roles'>{badge_froze}{badge_locked}{badge_admin}{badge_mod}{badge_ac}{badge_bot}{badge_gently}{badge_kobold}</div>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -236,6 +236,12 @@
|
|||
}
|
||||
|
||||
&.locked {
|
||||
color: lighten(pink, 12%);
|
||||
background-color: rgba(lighten(pink, 12%), 0.1);
|
||||
border-color: rgba(lighten(pink, 12%), 0.5);
|
||||
}
|
||||
|
||||
&.froze {
|
||||
color: lighten($warning-red, 12%);
|
||||
background-color: rgba(lighten($warning-red, 12%), 0.1);
|
||||
border-color: rgba(lighten($warning-red, 12%), 0.5);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"account.badges.gently": "Gentlies kobolds",
|
||||
"account.badges.kobold": "Gently the kobold",
|
||||
"account.badges.locked": "🔒 Locked",
|
||||
"account.badges.froze": "❄️ Frozen by admin",
|
||||
"account.block": "Block @{name}",
|
||||
"account.block_domain": "Hide {domain}",
|
||||
"account.blocked": "Blocked",
|
||||
|
|
|
@ -36,9 +36,9 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
|
|||
'mp' => 'https://monsterpit.net/ns#',
|
||||
'supportsChat' => 'mp:supportsChat'
|
||||
},
|
||||
locked: {
|
||||
froze: {
|
||||
'mp' => 'https://monsterpit.net/ns#',
|
||||
'locked' => 'mp:locked'
|
||||
'froze' => 'mp:froze'
|
||||
},
|
||||
}.freeze
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
# supports_chat :boolean default(FALSE), not null
|
||||
# gently :boolean default(FALSE), not null
|
||||
# kobold :boolean default(FALSE), not null
|
||||
# froze :boolean
|
||||
#
|
||||
|
||||
class Account < ApplicationRecord
|
||||
|
@ -172,6 +173,10 @@ class Account < ApplicationRecord
|
|||
moved_to_account_id.present?
|
||||
end
|
||||
|
||||
def frozen?
|
||||
local? ? (self&.user.nil? ? true : user.disabled?) : frozen
|
||||
end
|
||||
|
||||
def bot?
|
||||
%w(Application Service).include? actor_type
|
||||
end
|
||||
|
|
|
@ -7,14 +7,14 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
|||
|
||||
context_extensions :manually_approves_followers, :featured, :also_known_as,
|
||||
:moved_to, :property_value, :hashtag, :emoji, :identity_proof,
|
||||
:adult_content, :gently, :kobold, :supports_chat, :locked
|
||||
:adult_content, :gently, :kobold, :supports_chat, :froze
|
||||
|
||||
attributes :id, :type, :following, :followers,
|
||||
:inbox, :outbox, :featured,
|
||||
:preferred_username, :name, :summary,
|
||||
:url, :manually_approves_followers,
|
||||
:gently, :kobold, :adult_content,
|
||||
:supports_chat, :locked
|
||||
:supports_chat, :froze
|
||||
|
||||
has_one :public_key, serializer: ActivityPub::PublicKeySerializer
|
||||
|
||||
|
@ -113,6 +113,10 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
|||
object.locked
|
||||
end
|
||||
|
||||
def froze
|
||||
object.local? ? (object&.user.nil? ? true : object.user.disabled?) : object.froze?
|
||||
end
|
||||
|
||||
def virtual_tags
|
||||
object.emojis + object.tags
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ 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, :supports_chat, :gently, :kobold, :role
|
||||
:adult_content, :supports_chat, :gently, :kobold, :role, :froze
|
||||
|
||||
has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested?
|
||||
has_many :emojis, serializer: REST::CustomEmojiSerializer
|
||||
|
@ -62,4 +62,8 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
|||
return 'moderator' if object.user_moderator?
|
||||
'user'
|
||||
end
|
||||
|
||||
def froze
|
||||
object.local? ? (object&.user.nil? ? true : object.user.disabled?) : object.froze?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -79,6 +79,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||
@account.display_name = @json['name'] || ''
|
||||
@account.note = @json['summary'] || ''
|
||||
@account.locked = @json['manuallyApprovesFollowers'] || false
|
||||
@account.froze = @json['froze'] || false
|
||||
@account.adult_content = @json['adultContent'] || (@json['suggestedMinAge'].to_i >= 18)
|
||||
@account.supports_chat = @json['supportsChat'] || false
|
||||
@account.gently = @json['gently'] || false
|
||||
|
|
|
@ -76,6 +76,7 @@ en:
|
|||
gently: Gentlies kobolds
|
||||
adult_content: 🔞 Adult content
|
||||
locked: 🔒 Locked
|
||||
froze: ❄️ Frozen by admin
|
||||
unavailable: Profile unavailable
|
||||
unfollow: Unfollow
|
||||
admin:
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddFrozeToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :froze, :boolean
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2019_07_19_121326) do
|
||||
ActiveRecord::Schema.define(version: 2019_07_19_212820) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -154,6 +154,7 @@ ActiveRecord::Schema.define(version: 2019_07_19_121326) do
|
|||
t.boolean "supports_chat", default: false, null: false
|
||||
t.boolean "gently", default: false, null: false
|
||||
t.boolean "kobold", default: false, null: false
|
||||
t.boolean "froze"
|
||||
t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin
|
||||
t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
|
||||
t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"
|
||||
|
|
Loading…
Reference in New Issue