diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb
index ed58efdb4..fcf98fd70 100644
--- a/app/helpers/stream_entries_helper.rb
+++ b/app/helpers/stream_entries_helper.rb
@@ -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?
diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js
index 0f03770b7..f70593868 100644
--- a/app/javascript/flavours/glitch/features/account/components/header.js
+++ b/app/javascript/flavours/glitch/features/account/components/header.js
@@ -191,6 +191,7 @@ class Header extends ImmutablePureComponent {
const fields = account.get('fields');
const badge_locked = account.get('locked') ? (
) : null;
+ const badge_froze = account.get('froze') ? (
) : null;
const badge_bot = account.get('bot') ? (
) : null;
const badge_ac = account.get('adult_content') ? (
) : null;
const badge_gently = account.get('gently') ? (
) : null;
@@ -226,9 +227,10 @@ class Header extends ImmutablePureComponent {
+ {lockedIcon}
- @{acct} {lockedIcon}
-
{badge_locked}{badge_admin}{badge_mod}{badge_ac}{badge_bot}{badge_gently}{badge_kobold}
+ @{acct}
+ {badge_froze}{badge_locked}{badge_admin}{badge_mod}{badge_ac}{badge_bot}{badge_gently}{badge_kobold}
diff --git a/app/javascript/flavours/glitch/styles/accounts.scss b/app/javascript/flavours/glitch/styles/accounts.scss
index 49236fe4c..6c1de090e 100644
--- a/app/javascript/flavours/glitch/styles/accounts.scss
+++ b/app/javascript/flavours/glitch/styles/accounts.scss
@@ -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);
diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json
index d61277d76..11c828494 100644
--- a/app/javascript/mastodon/locales/en.json
+++ b/app/javascript/mastodon/locales/en.json
@@ -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",
diff --git a/app/lib/activitypub/adapter.rb b/app/lib/activitypub/adapter.rb
index 7b0b1390c..21a2c167b 100644
--- a/app/lib/activitypub/adapter.rb
+++ b/app/lib/activitypub/adapter.rb
@@ -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
diff --git a/app/models/account.rb b/app/models/account.rb
index 778b3fcbb..4b39cf022 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -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
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb
index 95110bfc2..85d2482db 100644
--- a/app/serializers/activitypub/actor_serializer.rb
+++ b/app/serializers/activitypub/actor_serializer.rb
@@ -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
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb
index 852ecdae1..bd98989e2 100644
--- a/app/serializers/rest/account_serializer.rb
+++ b/app/serializers/rest/account_serializer.rb
@@ -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
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb
index 6846f6d4e..bc1eb2057 100644
--- a/app/services/activitypub/process_account_service.rb
+++ b/app/services/activitypub/process_account_service.rb
@@ -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
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 705cbf793..42cd5a55c 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -76,6 +76,7 @@ en:
gently: Gentlies kobolds
adult_content: 🔞 Adult content
locked: 🔒 Locked
+ froze: ❄️ Frozen by admin
unavailable: Profile unavailable
unfollow: Unfollow
admin:
diff --git a/db/migrate/20190719212820_add_froze_to_accounts.rb b/db/migrate/20190719212820_add_froze_to_accounts.rb
new file mode 100644
index 000000000..d73baa7ba
--- /dev/null
+++ b/db/migrate/20190719212820_add_froze_to_accounts.rb
@@ -0,0 +1,5 @@
+class AddFrozeToAccounts < ActiveRecord::Migration[5.2]
+ def change
+ add_column :accounts, :froze, :boolean
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 2b147fd66..fccde6264 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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"