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)
|
def account_badge(account, all: false)
|
||||||
content_tag(:div, class: 'roles') do
|
content_tag(:div, class: 'roles') do
|
||||||
|
froze = account.local? ? (account&.user.nil? ? true : account.user.disabled?) : account.froze?
|
||||||
roles = []
|
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.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.bot'), class: 'account-role bot') if account.bot?
|
||||||
roles << content_tag(:div, t('accounts.roles.adult'), class: 'account-role adult') if account.adult_content?
|
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 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_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_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_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;
|
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'>
|
<div className='account__header__tabs__name'>
|
||||||
<h1>
|
<h1>
|
||||||
|
<span className='account__header__locked'>{lockedIcon}</span>
|
||||||
<span dangerouslySetInnerHTML={displayNameHtml} />
|
<span dangerouslySetInnerHTML={displayNameHtml} />
|
||||||
<small>@{acct} {lockedIcon}</small>
|
<small>@{acct}</small>
|
||||||
<div className='roles'>{badge_locked}{badge_admin}{badge_mod}{badge_ac}{badge_bot}{badge_gently}{badge_kobold}</div>
|
<div className='roles'>{badge_froze}{badge_locked}{badge_admin}{badge_mod}{badge_ac}{badge_bot}{badge_gently}{badge_kobold}</div>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -236,6 +236,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&.locked {
|
&.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%);
|
color: lighten($warning-red, 12%);
|
||||||
background-color: rgba(lighten($warning-red, 12%), 0.1);
|
background-color: rgba(lighten($warning-red, 12%), 0.1);
|
||||||
border-color: rgba(lighten($warning-red, 12%), 0.5);
|
border-color: rgba(lighten($warning-red, 12%), 0.5);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"account.badges.gently": "Gentlies kobolds",
|
"account.badges.gently": "Gentlies kobolds",
|
||||||
"account.badges.kobold": "Gently the kobold",
|
"account.badges.kobold": "Gently the kobold",
|
||||||
"account.badges.locked": "🔒 Locked",
|
"account.badges.locked": "🔒 Locked",
|
||||||
|
"account.badges.froze": "❄️ Frozen by admin",
|
||||||
"account.block": "Block @{name}",
|
"account.block": "Block @{name}",
|
||||||
"account.block_domain": "Hide {domain}",
|
"account.block_domain": "Hide {domain}",
|
||||||
"account.blocked": "Blocked",
|
"account.blocked": "Blocked",
|
||||||
|
|
|
@ -36,9 +36,9 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
|
||||||
'mp' => 'https://monsterpit.net/ns#',
|
'mp' => 'https://monsterpit.net/ns#',
|
||||||
'supportsChat' => 'mp:supportsChat'
|
'supportsChat' => 'mp:supportsChat'
|
||||||
},
|
},
|
||||||
locked: {
|
froze: {
|
||||||
'mp' => 'https://monsterpit.net/ns#',
|
'mp' => 'https://monsterpit.net/ns#',
|
||||||
'locked' => 'mp:locked'
|
'froze' => 'mp:froze'
|
||||||
},
|
},
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
# supports_chat :boolean default(FALSE), not null
|
# supports_chat :boolean default(FALSE), not null
|
||||||
# gently :boolean default(FALSE), not null
|
# gently :boolean default(FALSE), not null
|
||||||
# kobold :boolean default(FALSE), not null
|
# kobold :boolean default(FALSE), not null
|
||||||
|
# froze :boolean
|
||||||
#
|
#
|
||||||
|
|
||||||
class Account < ApplicationRecord
|
class Account < ApplicationRecord
|
||||||
|
@ -172,6 +173,10 @@ class Account < ApplicationRecord
|
||||||
moved_to_account_id.present?
|
moved_to_account_id.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def frozen?
|
||||||
|
local? ? (self&.user.nil? ? true : user.disabled?) : frozen
|
||||||
|
end
|
||||||
|
|
||||||
def bot?
|
def bot?
|
||||||
%w(Application Service).include? actor_type
|
%w(Application Service).include? actor_type
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,14 +7,14 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
||||||
|
|
||||||
context_extensions :manually_approves_followers, :featured, :also_known_as,
|
context_extensions :manually_approves_followers, :featured, :also_known_as,
|
||||||
:moved_to, :property_value, :hashtag, :emoji, :identity_proof,
|
: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,
|
attributes :id, :type, :following, :followers,
|
||||||
:inbox, :outbox, :featured,
|
:inbox, :outbox, :featured,
|
||||||
:preferred_username, :name, :summary,
|
:preferred_username, :name, :summary,
|
||||||
:url, :manually_approves_followers,
|
:url, :manually_approves_followers,
|
||||||
:gently, :kobold, :adult_content,
|
:gently, :kobold, :adult_content,
|
||||||
:supports_chat, :locked
|
:supports_chat, :froze
|
||||||
|
|
||||||
has_one :public_key, serializer: ActivityPub::PublicKeySerializer
|
has_one :public_key, serializer: ActivityPub::PublicKeySerializer
|
||||||
|
|
||||||
|
@ -113,6 +113,10 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
||||||
object.locked
|
object.locked
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def froze
|
||||||
|
object.local? ? (object&.user.nil? ? true : object.user.disabled?) : object.froze?
|
||||||
|
end
|
||||||
|
|
||||||
def virtual_tags
|
def virtual_tags
|
||||||
object.emojis + object.tags
|
object.emojis + object.tags
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||||
attributes :id, :username, :acct, :display_name, :locked, :bot, :created_at,
|
attributes :id, :username, :acct, :display_name, :locked, :bot, :created_at,
|
||||||
:note, :url, :avatar, :avatar_static, :header, :header_static,
|
:note, :url, :avatar, :avatar_static, :header, :header_static,
|
||||||
:followers_count, :following_count, :statuses_count, :replies,
|
: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_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested?
|
||||||
has_many :emojis, serializer: REST::CustomEmojiSerializer
|
has_many :emojis, serializer: REST::CustomEmojiSerializer
|
||||||
|
@ -62,4 +62,8 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||||
return 'moderator' if object.user_moderator?
|
return 'moderator' if object.user_moderator?
|
||||||
'user'
|
'user'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def froze
|
||||||
|
object.local? ? (object&.user.nil? ? true : object.user.disabled?) : object.froze?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -79,6 +79,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
||||||
@account.display_name = @json['name'] || ''
|
@account.display_name = @json['name'] || ''
|
||||||
@account.note = @json['summary'] || ''
|
@account.note = @json['summary'] || ''
|
||||||
@account.locked = @json['manuallyApprovesFollowers'] || false
|
@account.locked = @json['manuallyApprovesFollowers'] || false
|
||||||
|
@account.froze = @json['froze'] || false
|
||||||
@account.adult_content = @json['adultContent'] || (@json['suggestedMinAge'].to_i >= 18)
|
@account.adult_content = @json['adultContent'] || (@json['suggestedMinAge'].to_i >= 18)
|
||||||
@account.supports_chat = @json['supportsChat'] || false
|
@account.supports_chat = @json['supportsChat'] || false
|
||||||
@account.gently = @json['gently'] || false
|
@account.gently = @json['gently'] || false
|
||||||
|
|
|
@ -76,6 +76,7 @@ en:
|
||||||
gently: Gentlies kobolds
|
gently: Gentlies kobolds
|
||||||
adult_content: 🔞 Adult content
|
adult_content: 🔞 Adult content
|
||||||
locked: 🔒 Locked
|
locked: 🔒 Locked
|
||||||
|
froze: ❄️ Frozen by admin
|
||||||
unavailable: Profile unavailable
|
unavailable: Profile unavailable
|
||||||
unfollow: Unfollow
|
unfollow: Unfollow
|
||||||
admin:
|
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.
|
# 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
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
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 "supports_chat", default: false, null: false
|
||||||
t.boolean "gently", default: false, null: false
|
t.boolean "gently", default: false, null: false
|
||||||
t.boolean "kobold", 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 "(((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 "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"
|
t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"
|
||||||
|
|
Loading…
Reference in New Issue