about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/settings/profiles_controller.rb2
-rw-r--r--app/helpers/stream_entries_helper.rb6
-rw-r--r--app/javascript/flavours/glitch/features/account/components/header.js8
-rw-r--r--app/javascript/flavours/glitch/styles/accounts.scss2
-rw-r--r--app/javascript/mastodon/locales/en.json4
-rw-r--r--app/lib/activitypub/adapter.rb18
-rw-r--r--app/models/account.rb5
-rw-r--r--app/serializers/activitypub/actor_serializer.rb15
-rw-r--r--app/serializers/rest/account_serializer.rb10
-rw-r--r--app/services/activitypub/process_account_service.rb5
-rw-r--r--app/views/settings/profiles/show.html.haml9
11 files changed, 48 insertions, 36 deletions
diff --git a/app/controllers/settings/profiles_controller.rb b/app/controllers/settings/profiles_controller.rb
index e30079a0f..eefd48371 100644
--- a/app/controllers/settings/profiles_controller.rb
+++ b/app/controllers/settings/profiles_controller.rb
@@ -25,7 +25,7 @@ class Settings::ProfilesController < Settings::BaseController
   private
 
   def account_params
-    params.require(:account).permit(:display_name, :note, :avatar, :header, :replies, :locked, :hidden, :unlisted, :adults_only, :bot, :discoverable, fields_attributes: [:name, :value])
+    params.require(:account).permit(:display_name, :note, :avatar, :header, :replies, :locked, :hidden, :unlisted, :supports_chat, :gently, :kobold, :adults_content, :bot, :discoverable, fields_attributes: [:name, :value])
   end
 
   def set_account
diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb
index a7d113a22..fe8505f3b 100644
--- a/app/helpers/stream_entries_helper.rb
+++ b/app/helpers/stream_entries_helper.rb
@@ -38,9 +38,9 @@ module StreamEntriesHelper
     content_tag(:div, class: 'roles') do
       roles = []
       roles << content_tag(:div, t('accounts.roles.bot'), class: 'account-role bot') if account.bot?
-      roles << content_tag(:div, t('accounts.roles.adults_only'), class: 'account-role adults-only') if account.adults_only?
-      roles << content_tag(:div, t('accounts.roles.gentlies_kobolds'), class: 'account-role gentlies') if account.user_gentlies_kobolds?
-      roles << content_tag(:div, t('accounts.roles.kobold'), class: 'account-role kobold') if account.user_is_a_kobold?
+      roles << content_tag(:div, t('accounts.roles.adult'), class: 'account-role adult') if account.adult_content?
+      roles << content_tag(:div, t('accounts.roles.gently'), class: 'account-role gently') if account.gently?
+      roles << content_tag(:div, t('accounts.roles.kobold'), class: 'account-role kobold') if account.kobold?
 
       if (Setting.show_staff_badge && account.user_staff?) || all
         if all && !account.user_staff?
diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js
index 8758c6cca..2b4adb4f5 100644
--- a/app/javascript/flavours/glitch/features/account/components/header.js
+++ b/app/javascript/flavours/glitch/features/account/components/header.js
@@ -190,9 +190,9 @@ class Header extends ImmutablePureComponent {
     const displayNameHtml = { __html: account.get('display_name_html') };
     const fields          = account.get('fields');
     const badge_bot       = account.get('bot') ? (<div className='account-role bot'><FormattedMessage id='account.badges.bot' defaultMessage='Bot' /></div>) : null;
-    const badge_ao        = account.get('adults_only') ? (<div className='account-role adults-only'><FormattedMessage id='account.badges.adults_only' defaultMessage="🔞 Adult content" /></div>) : null;
-    const badge_gntly_kbld = account.get('gentlies_kobolds') ? (<div className='account-role gentlies'><FormattedMessage id='account.badges.gentlies_kobolds' defaultMessage="Gentlies kobolds" /></div>) : null;
-    const badge_kobold    = account.get('is_a_kobold') ? (<div className='account-role kobold'><FormattedMessage id='account.badges.kobold' defaultMessage="Gently the kobold" /></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_kobold    = account.get('kobold') ? (<div className='account-role kobold'><FormattedMessage id='account.badges.kobold' defaultMessage="Gently the kobold" /></div>) : null;
     const badge_mod       = account.get('role') == 'moderator' ? (<div className='account-role moderator'><FormattedMessage id='account.badges.moderator' defaultMessage="Moderator" /></div>) : null;
     const badge_admin     = account.get('role') == 'admin' ? (<div className='account-role admin'><FormattedMessage id='account.badges.admin' defaultMessage="Admin" /></div>) : null;
     const acct            = account.get('acct').indexOf('@') === -1 && domain ? `${account.get('acct')}@${domain}` : account.get('acct');
@@ -226,7 +226,7 @@ class Header extends ImmutablePureComponent {
             <h1>
               <span dangerouslySetInnerHTML={displayNameHtml} />
               <small>@{acct} {lockedIcon}</small>
-              <div className='roles'>{badge_admin}{badge_mod}{badge_ao}{badge_bot}{badge_gntly_kbld}{badge_kobold}</div>
+              <div className='roles'>{badge_admin}{badge_mod}{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 02e589cc0..65c7fc80c 100644
--- a/app/javascript/flavours/glitch/styles/accounts.scss
+++ b/app/javascript/flavours/glitch/styles/accounts.scss
@@ -223,7 +223,7 @@
     border-color: rgba(lighten($error-red, 12%), 0.5);
   }
 
-  &.gentlies {
+  &.gently {
     color: lighten(cyan, 25%);
     background-color: rgba(lighten(cyan, 25%), 0.1);
     border-color: rgba(lighten(cyan, 25%), 0.1);
diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json
index 9c8dbbb7d..d82863a1f 100644
--- a/app/javascript/mastodon/locales/en.json
+++ b/app/javascript/mastodon/locales/en.json
@@ -1,8 +1,8 @@
 {
   "account.add_or_remove_from_list": "Add or Remove from lists",
   "account.badges.bot": "Bot",
-  "account.badges.adults_only": "🔞 Adult content",
-  "account.badges.gentlies_kobolds": "Gentlies kobolds",
+  "account.badges.adult": "🔞 Adult content",
+  "account.badges.gently": "Gentlies kobolds",
   "account.badges.kobold": "Gently the kobold",
   "account.block": "Block @{name}",
   "account.block_domain": "Hide {domain}",
diff --git a/app/lib/activitypub/adapter.rb b/app/lib/activitypub/adapter.rb
index 4c0231ad7..2278ecc2c 100644
--- a/app/lib/activitypub/adapter.rb
+++ b/app/lib/activitypub/adapter.rb
@@ -19,7 +19,23 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
     focal_point: { 'toot' => 'http://joinmastodon.org/ns#', 'focalPoint' => { '@container' => '@list', '@id' => 'toot:focalPoint' } },
     identity_proof: { 'toot' => 'http://joinmastodon.org/ns#', 'IdentityProof' => 'toot:IdentityProof' },
     blurhash: { 'toot' => 'http://joinmastodon.org/ns#', 'blurhash' => 'toot:blurhash' },
-    adults_only: { 'schema' => 'http://schema.org#', 'suggestedMinAge' => 'schema:suggestedMinAge' }
+
+    adult_content: {
+      'mp' => 'https://monsterpit.net/ns#',
+      'adultContent' => 'mp:adultContent'
+    }
+    gently: {
+      'mp' => 'https://monsterpit.net/ns#',
+      'gently' => 'mp:gently'
+    }
+    kobold: {
+      'mp' => 'https://monsterpit.net/ns#',
+      'kobold' => 'mp:kobold'
+    }
+    supports_chat: {
+      'mp' => 'https://monsterpit.net/ns#',
+      'supportsChat' => 'mp:supportsChat'
+    }
   }.freeze
 
   def self.default_key_transform
diff --git a/app/models/account.rb b/app/models/account.rb
index 7040f138b..8187bc7d9 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -45,9 +45,12 @@
 #  unlisted                :boolean          default(FALSE), not null
 #  force_unlisted          :boolean          default(FALSE), not null
 #  force_sensitive         :boolean          default(FALSE), not null
-#  adults_only             :boolean          default(FALSE), not null
+#  adult_content           :boolean          default(FALSE), not null
 #  silenced_at             :datetime
 #  suspended_at            :datetime
+#  supports_chat           :boolean          default(FALSE), not null
+#  gently                  :boolean          default(FALSE), not null
+#  kobold                  :boolean          default(FALSE), not null
 #
 
 class Account < ApplicationRecord
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb
index 2af3c0701..a260a6f1f 100644
--- a/app/serializers/activitypub/actor_serializer.rb
+++ b/app/serializers/activitypub/actor_serializer.rb
@@ -7,12 +7,14 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
 
   context_extensions :manually_approves_followers, :featured, :also_known_as,
                      :moved_to, :property_value, :hashtag, :emoji, :identity_proof,
-                     :adults_only
+                     :adult_content, :gently, :kobold, :supports_chat
 
   attributes :id, :type, :following, :followers,
              :inbox, :outbox, :featured,
              :preferred_username, :name, :summary,
-             :url, :manually_approves_followers
+             :url, :manually_approves_followers,
+             :gently, :kobold, :adult_content,
+             :supports_chat
 
   has_one :public_key, serializer: ActivityPub::PublicKeySerializer
 
@@ -21,7 +23,6 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
 
   attribute :moved_to, if: :moved?
   attribute :also_known_as, if: :also_known_as?
-  attribute :adults_only, key: :suggestedMinAge, if: :adults_only?
 
   class EndpointsSerializer < ActivityPub::Serializer
     include RoutingHelper
@@ -68,10 +69,6 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
     account_collection_url(object, :featured)
   end
 
-  def adults_only
-    18
-  end
-
   def endpoints
     object
   end
@@ -132,10 +129,6 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
     !object.also_known_as.empty?
   end
 
-  def adults_only?
-    object.adults_only
-  end
-
   class CustomEmojiSerializer < ActivityPub::EmojiSerializer
   end
 
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb
index 7716aafde..852ecdae1 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,
-             :adults_only, :gentlies_kobolds, :is_a_kobold, :role
+             :adult_content, :supports_chat, :gently, :kobold, :role
 
   has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested?
   has_many :emojis, serializer: REST::CustomEmojiSerializer
@@ -57,14 +57,6 @@ class REST::AccountSerializer < ActiveModel::Serializer
     (Setting.hide_followers_count || object.user&.setting_hide_followers_count) ? -1 : object.followers_count
   end
 
-  def gentlies_kobolds
-    object.user_gentlies_kobolds? || false
-  end
-
-  def is_a_kobold
-    object.user_is_a_kobold? || false
-  end
-
   def role
     return 'admin' if object.user_admin?
     return 'moderator' if object.user_moderator?
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb
index 414dbfda7..6846f6d4e 100644
--- a/app/services/activitypub/process_account_service.rb
+++ b/app/services/activitypub/process_account_service.rb
@@ -79,7 +79,10 @@ class ActivityPub::ProcessAccountService < BaseService
     @account.display_name            = @json['name'] || ''
     @account.note                    = @json['summary'] || ''
     @account.locked                  = @json['manuallyApprovesFollowers'] || false
-    @account.adults_only             = @json['suggestedMinAge'].to_i >= 18
+    @account.adult_content           = @json['adultContent'] || (@json['suggestedMinAge'].to_i >= 18)
+    @account.supports_chat           = @json['supportsChat'] || false
+    @account.gently                  = @json['gently'] || false
+    @account.kobold                  = @json['kobold'] || false
     @account.fields                  = property_values || {}
     @account.also_known_as           = as_array(@json['alsoKnownAs'] || []).map { |item| value_or_id(item) }
     @account.actor_type              = actor_type
diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml
index 8a7ccfd37..18addcd50 100644
--- a/app/views/settings/profiles/show.html.haml
+++ b/app/views/settings/profiles/show.html.haml
@@ -22,16 +22,21 @@
 
   .fields-group
     = f.input :locked, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.locked')
-    = f.input :hidden, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.hidden')
+    = f.input :hidden, as: :boolean, wrapper: :with_label
     = f.input :unlisted, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.unlisted')
     = f.input :replies, as: :boolean, wrapper: :with_label
+    = f.input :supports_chat, as: :boolean, wrapper: :with_label
 
   .fields-group
-    = f.input :adults_only, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.adults_only')
+    = f.input :adult_content, as: :boolean, wrapper: :with_label
 
   .fields-group
     = f.input :bot, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.bot')
 
+  .fields-group
+    = f.input :gently, as: :boolean, wrapper: :with_label
+    = f.input :kobold, as: :boolean, wrapper: :with_label
+
   - if Setting.profile_directory
     .fields-group
       = f.input :discoverable, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.discoverable_html', min_followers: Account::MIN_FOLLOWERS_DISCOVERY, path: explore_path)