diff --git a/app/helpers/context_helper.rb b/app/helpers/context_helper.rb
index 5f571200c5..7d982d8a40 100644
--- a/app/helpers/context_helper.rb
+++ b/app/helpers/context_helper.rb
@@ -24,6 +24,7 @@ module ContextHelper
emoji_reactions: { 'fedibird' => 'http://fedibird.com/ns#', 'emojiReactions' => { '@id' => 'fedibird:emojiReactions', '@type' => '@id' } },
searchable_by: { 'fedibird' => 'http://fedibird.com/ns#', 'searchableBy' => { '@id' => 'fedibird:searchableBy', '@type' => '@id' } },
subscribable_by: { 'kmyblue' => 'http://kmy.blue/ns#', 'subscribableBy' => { '@id' => 'kmyblue:subscribableBy', '@type' => '@id' } },
+ other_setting: { 'fedibird' => 'http://fedibird.com/ns#', 'otherSetting' => 'fedibird:otherSetting' },
olm: { 'toot' => 'http://joinmastodon.org/ns#', 'Device' => 'toot:Device', 'Ed25519Signature' => 'toot:Ed25519Signature', 'Ed25519Key' => 'toot:Ed25519Key', 'Curve25519Key' => 'toot:Curve25519Key', 'EncryptedMessage' => 'toot:EncryptedMessage', 'publicKeyBase64' => 'toot:publicKeyBase64', 'deviceId' => 'toot:deviceId', 'claim' => { '@type' => '@id', '@id' => 'toot:claim' }, 'fingerprintKey' => { '@type' => '@id', '@id' => 'toot:fingerprintKey' }, 'identityKey' => { '@type' => '@id', '@id' => 'toot:identityKey' }, 'devices' => { '@type' => '@id', '@id' => 'toot:devices' }, 'messageFranking' => 'toot:messageFranking', 'messageType' => 'toot:messageType', 'cipherText' => 'toot:cipherText' },
suspended: { 'toot' => 'http://joinmastodon.org/ns#', 'suspended' => 'toot:suspended' },
}.freeze
diff --git a/app/javascript/mastodon/components/account.jsx b/app/javascript/mastodon/components/account.jsx
index 1056ccf046..fbda94caee 100644
--- a/app/javascript/mastodon/components/account.jsx
+++ b/app/javascript/mastodon/components/account.jsx
@@ -152,7 +152,7 @@ class Account extends ImmutablePureComponent {
- {!minimal && <> {verification} {muteTimeRemaining}>}
+ {!minimal && <> {verification} {muteTimeRemaining}>}
diff --git a/app/javascript/mastodon/components/short_number.jsx b/app/javascript/mastodon/components/short_number.jsx
index 0c40941c0d..da9c493ab6 100644
--- a/app/javascript/mastodon/components/short_number.jsx
+++ b/app/javascript/mastodon/components/short_number.jsx
@@ -27,7 +27,7 @@ import { FormattedMessage, FormattedNumber } from 'react-intl';
* @param {ShortNumberProps} param0 Props for the component
* @returns {JSX.Element} Rendered number
*/
-function ShortNumber({ value, renderer, children }) {
+function ShortNumber({ value, isHide, renderer, children }) {
const shortNumber = toShortNumber(value);
const [, division] = shortNumber;
@@ -37,7 +37,7 @@ function ShortNumber({ value, renderer, children }) {
const customRenderer = children != null ? children : renderer;
- const displayNumber = ;
+ const displayNumber = !isHide ? : -;
return customRenderer != null
? customRenderer(displayNumber, pluralReady(value, division))
@@ -46,6 +46,7 @@ function ShortNumber({ value, renderer, children }) {
ShortNumber.propTypes = {
value: PropTypes.number.isRequired,
+ isHide: PropTypes.bool,
renderer: PropTypes.func,
children: PropTypes.func,
};
diff --git a/app/javascript/mastodon/features/account/components/header.jsx b/app/javascript/mastodon/features/account/components/header.jsx
index c46cf7f29b..b842c01d35 100644
--- a/app/javascript/mastodon/features/account/components/header.jsx
+++ b/app/javascript/mastodon/features/account/components/header.jsx
@@ -451,6 +451,7 @@ class Header extends ImmutablePureComponent {
@@ -458,6 +459,7 @@ class Header extends ImmutablePureComponent {
@@ -465,6 +467,7 @@ class Header extends ImmutablePureComponent {
diff --git a/app/models/account.rb b/app/models/account.rb
index b6bcd8730c..fa98eea1db 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -53,6 +53,7 @@
# group_allow_private_message :boolean
# searchability :integer default("private"), not null
# dissubscribable :boolean default(FALSE), not null
+# settings :jsonb
#
class Account < ApplicationRecord
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb
index d8588af450..755bc8f03f 100644
--- a/app/serializers/activitypub/actor_serializer.rb
+++ b/app/serializers/activitypub/actor_serializer.rb
@@ -13,7 +13,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
:inbox, :outbox, :featured, :featured_tags,
:preferred_username, :name, :summary,
:url, :manually_approves_followers,
- :discoverable, :published, :searchable_by, :subscribable_by
+ :discoverable, :published, :searchable_by, :subscribable_by, :obher_setting
has_one :public_key, serializer: ActivityPub::PublicKeySerializer
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb
index c879766c50..722f81fa3b 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, :discoverable, :group, :created_at,
:note, :url, :avatar, :avatar_static, :header, :header_static, :searchability, :subscribable,
- :followers_count, :following_count, :statuses_count, :last_status_at
+ :followers_count, :following_count, :statuses_count, :last_status_at, :other_settings
has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested?
@@ -123,6 +123,10 @@ class REST::AccountSerializer < ActiveModel::Serializer
object.suspended? ? [] : object.fields
end
+ def other_settings
+ object.suspended? || object.settings.nil? ? {} : object.settings
+ end
+
def suspended
object.suspended?
end
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb
index 593017c71c..126c35b48c 100644
--- a/app/services/activitypub/process_account_service.rb
+++ b/app/services/activitypub/process_account_service.rb
@@ -117,6 +117,7 @@ class ActivityPub::ProcessAccountService < BaseService
@account.discoverable = @json['discoverable'] || false
@account.searchability = searchability_from_audience
@account.dissubscribable = !subscribable(@account.note)
+ @account.settings = other_settings
end
def set_fetchable_key!
@@ -265,6 +266,12 @@ class ActivityPub::ProcessAccountService < BaseService
end
end
+ def other_settings
+ return {} unless @json['otherSetting'].is_a?(Array)
+
+ @json['otherSetting'].each_with_object({}) { |v, h| h.merge!({ v['name'] => v['value'] }) if v['type'] == 'PropertyValue' }
+ end
+
def property_values
return unless @json['attachment'].is_a?(Array)
diff --git a/db/migrate/20230514030455_add_settings_to_accounts.rb b/db/migrate/20230514030455_add_settings_to_accounts.rb
new file mode 100644
index 0000000000..98d9a8195b
--- /dev/null
+++ b/db/migrate/20230514030455_add_settings_to_accounts.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddSettingsToAccounts < ActiveRecord::Migration[6.1]
+ def change
+ add_column :accounts, :settings, :jsonb
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index ce91eb7258..8d14ab1315 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -12,7 +12,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2023_05_12_122757) do
+ActiveRecord::Schema.define(version: 2023_05_14_030455) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -194,6 +194,7 @@ ActiveRecord::Schema.define(version: 2023_05_12_122757) do
t.boolean "group_allow_private_message"
t.integer "searchability", default: 2, null: false
t.boolean "dissubscribable", default: false, null: false
+ t.jsonb "settings"
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), COALESCE(lower((domain)::text), ''::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", where: "(moved_to_account_id IS NOT NULL)"