add `supports_chat` property, rename `adults_only` to `adult_content`, federate the kobolds~
parent
cf3ec71aa5
commit
5e3ea221a8
|
@ -25,7 +25,7 @@ class Settings::ProfilesController < Settings::BaseController
|
||||||
private
|
private
|
||||||
|
|
||||||
def account_params
|
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
|
end
|
||||||
|
|
||||||
def set_account
|
def set_account
|
||||||
|
|
|
@ -38,9 +38,9 @@ module StreamEntriesHelper
|
||||||
content_tag(:div, class: 'roles') do
|
content_tag(:div, class: 'roles') do
|
||||||
roles = []
|
roles = []
|
||||||
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.adults_only'), class: 'account-role adults-only') if account.adults_only?
|
roles << content_tag(:div, t('accounts.roles.adult'), class: 'account-role adult') if account.adult_content?
|
||||||
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.gently'), class: 'account-role gently') if account.gently?
|
||||||
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.kobold'), class: 'account-role kobold') if account.kobold?
|
||||||
|
|
||||||
if (Setting.show_staff_badge && account.user_staff?) || all
|
if (Setting.show_staff_badge && account.user_staff?) || all
|
||||||
if all && !account.user_staff?
|
if all && !account.user_staff?
|
||||||
|
|
|
@ -190,9 +190,9 @@ class Header extends ImmutablePureComponent {
|
||||||
const displayNameHtml = { __html: account.get('display_name_html') };
|
const displayNameHtml = { __html: account.get('display_name_html') };
|
||||||
const fields = account.get('fields');
|
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_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_ac = account.get('adult_content') ? (<div className='account-role adult'><FormattedMessage id='account.badges.adult' 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_gently = account.get('gently') ? (<div className='account-role gently'><FormattedMessage id='account.badges.gently' 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_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_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 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');
|
const acct = account.get('acct').indexOf('@') === -1 && domain ? `${account.get('acct')}@${domain}` : account.get('acct');
|
||||||
|
@ -226,7 +226,7 @@ class Header extends ImmutablePureComponent {
|
||||||
<h1>
|
<h1>
|
||||||
<span dangerouslySetInnerHTML={displayNameHtml} />
|
<span dangerouslySetInnerHTML={displayNameHtml} />
|
||||||
<small>@{acct} {lockedIcon}</small>
|
<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>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@
|
||||||
border-color: rgba(lighten($error-red, 12%), 0.5);
|
border-color: rgba(lighten($error-red, 12%), 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.gentlies {
|
&.gently {
|
||||||
color: lighten(cyan, 25%);
|
color: lighten(cyan, 25%);
|
||||||
background-color: rgba(lighten(cyan, 25%), 0.1);
|
background-color: rgba(lighten(cyan, 25%), 0.1);
|
||||||
border-color: rgba(lighten(cyan, 25%), 0.1);
|
border-color: rgba(lighten(cyan, 25%), 0.1);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"account.add_or_remove_from_list": "Add or Remove from lists",
|
"account.add_or_remove_from_list": "Add or Remove from lists",
|
||||||
"account.badges.bot": "Bot",
|
"account.badges.bot": "Bot",
|
||||||
"account.badges.adults_only": "🔞 Adult content",
|
"account.badges.adult": "🔞 Adult content",
|
||||||
"account.badges.gentlies_kobolds": "Gentlies kobolds",
|
"account.badges.gently": "Gentlies kobolds",
|
||||||
"account.badges.kobold": "Gently the kobold",
|
"account.badges.kobold": "Gently the kobold",
|
||||||
"account.block": "Block @{name}",
|
"account.block": "Block @{name}",
|
||||||
"account.block_domain": "Hide {domain}",
|
"account.block_domain": "Hide {domain}",
|
||||||
|
|
|
@ -19,7 +19,23 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
|
||||||
focal_point: { 'toot' => 'http://joinmastodon.org/ns#', 'focalPoint' => { '@container' => '@list', '@id' => 'toot:focalPoint' } },
|
focal_point: { 'toot' => 'http://joinmastodon.org/ns#', 'focalPoint' => { '@container' => '@list', '@id' => 'toot:focalPoint' } },
|
||||||
identity_proof: { 'toot' => 'http://joinmastodon.org/ns#', 'IdentityProof' => 'toot:IdentityProof' },
|
identity_proof: { 'toot' => 'http://joinmastodon.org/ns#', 'IdentityProof' => 'toot:IdentityProof' },
|
||||||
blurhash: { 'toot' => 'http://joinmastodon.org/ns#', 'blurhash' => 'toot:blurhash' },
|
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
|
}.freeze
|
||||||
|
|
||||||
def self.default_key_transform
|
def self.default_key_transform
|
||||||
|
|
|
@ -45,9 +45,12 @@
|
||||||
# unlisted :boolean default(FALSE), not null
|
# unlisted :boolean default(FALSE), not null
|
||||||
# force_unlisted :boolean default(FALSE), not null
|
# force_unlisted :boolean default(FALSE), not null
|
||||||
# force_sensitive :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
|
# silenced_at :datetime
|
||||||
# suspended_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
|
class Account < ApplicationRecord
|
||||||
|
|
|
@ -7,12 +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,
|
||||||
:adults_only
|
:adult_content, :gently, :kobold, :supports_chat
|
||||||
|
|
||||||
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,
|
||||||
|
:supports_chat
|
||||||
|
|
||||||
has_one :public_key, serializer: ActivityPub::PublicKeySerializer
|
has_one :public_key, serializer: ActivityPub::PublicKeySerializer
|
||||||
|
|
||||||
|
@ -21,7 +23,6 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
||||||
|
|
||||||
attribute :moved_to, if: :moved?
|
attribute :moved_to, if: :moved?
|
||||||
attribute :also_known_as, if: :also_known_as?
|
attribute :also_known_as, if: :also_known_as?
|
||||||
attribute :adults_only, key: :suggestedMinAge, if: :adults_only?
|
|
||||||
|
|
||||||
class EndpointsSerializer < ActivityPub::Serializer
|
class EndpointsSerializer < ActivityPub::Serializer
|
||||||
include RoutingHelper
|
include RoutingHelper
|
||||||
|
@ -68,10 +69,6 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
||||||
account_collection_url(object, :featured)
|
account_collection_url(object, :featured)
|
||||||
end
|
end
|
||||||
|
|
||||||
def adults_only
|
|
||||||
18
|
|
||||||
end
|
|
||||||
|
|
||||||
def endpoints
|
def endpoints
|
||||||
object
|
object
|
||||||
end
|
end
|
||||||
|
@ -132,10 +129,6 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
||||||
!object.also_known_as.empty?
|
!object.also_known_as.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def adults_only?
|
|
||||||
object.adults_only
|
|
||||||
end
|
|
||||||
|
|
||||||
class CustomEmojiSerializer < ActivityPub::EmojiSerializer
|
class CustomEmojiSerializer < ActivityPub::EmojiSerializer
|
||||||
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,
|
||||||
: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_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
|
||||||
|
@ -57,14 +57,6 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||||
(Setting.hide_followers_count || object.user&.setting_hide_followers_count) ? -1 : object.followers_count
|
(Setting.hide_followers_count || object.user&.setting_hide_followers_count) ? -1 : object.followers_count
|
||||||
end
|
end
|
||||||
|
|
||||||
def gentlies_kobolds
|
|
||||||
object.user_gentlies_kobolds? || false
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_a_kobold
|
|
||||||
object.user_is_a_kobold? || false
|
|
||||||
end
|
|
||||||
|
|
||||||
def role
|
def role
|
||||||
return 'admin' if object.user_admin?
|
return 'admin' if object.user_admin?
|
||||||
return 'moderator' if object.user_moderator?
|
return 'moderator' if object.user_moderator?
|
||||||
|
|
|
@ -79,7 +79,10 @@ 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.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.fields = property_values || {}
|
||||||
@account.also_known_as = as_array(@json['alsoKnownAs'] || []).map { |item| value_or_id(item) }
|
@account.also_known_as = as_array(@json['alsoKnownAs'] || []).map { |item| value_or_id(item) }
|
||||||
@account.actor_type = actor_type
|
@account.actor_type = actor_type
|
||||||
|
|
|
@ -22,16 +22,21 @@
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :locked, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.locked')
|
= 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 :unlisted, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.unlisted')
|
||||||
= f.input :replies, as: :boolean, wrapper: :with_label
|
= f.input :replies, as: :boolean, wrapper: :with_label
|
||||||
|
= f.input :supports_chat, as: :boolean, wrapper: :with_label
|
||||||
|
|
||||||
.fields-group
|
.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
|
.fields-group
|
||||||
= f.input :bot, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.bot')
|
= 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
|
- if Setting.profile_directory
|
||||||
.fields-group
|
.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)
|
= 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)
|
||||||
|
|
|
@ -10,8 +10,6 @@ en:
|
||||||
type_html: Choose what to do with <strong>%{acct}</strong>
|
type_html: Choose what to do with <strong>%{acct}</strong>
|
||||||
warning_preset_id: Optional. You can still add custom text to end of the preset
|
warning_preset_id: Optional. You can still add custom text to end of the preset
|
||||||
defaults:
|
defaults:
|
||||||
hidden: Toggles whether your public profile is publicaly accessible
|
|
||||||
adults_only: This account may contain mature or sensitive content
|
|
||||||
unlisted: Excludes you from public repeated/admired by lists of *local* monsters
|
unlisted: Excludes you from public repeated/admired by lists of *local* monsters
|
||||||
autofollow: People who sign up through the invite will automatically join your pack
|
autofollow: People who sign up through the invite will automatically join your pack
|
||||||
avatar: PNG, GIF or JPG. At most %{size}. Will be downscaled to %{dimensions}px
|
avatar: PNG, GIF or JPG. At most %{size}. Will be downscaled to %{dimensions}px
|
||||||
|
@ -76,7 +74,10 @@ en:
|
||||||
warning_preset_id: Use a warning preset
|
warning_preset_id: Use a warning preset
|
||||||
defaults:
|
defaults:
|
||||||
hidden: Disable your public profile
|
hidden: Disable your public profile
|
||||||
adults_only: Adult content
|
adult_content: Contains adult content
|
||||||
|
supports_chat: Allow chat messages
|
||||||
|
gently: Gently the kobolds
|
||||||
|
kobold: I am a kobold
|
||||||
unlisted: Exclude from public interaction lists
|
unlisted: Exclude from public interaction lists
|
||||||
replies: Show your public replies
|
replies: Show your public replies
|
||||||
autofollow: Invite to join your pack
|
autofollow: Invite to join your pack
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddSupportsChatToAccounts < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
safety_assured { add_column :accounts, :supports_chat, :boolean, null: false, default: false }
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
class AddKoboldsToAccounts < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
safety_assured { add_column :accounts, :gently, :boolean, null: false, default: false }
|
||||||
|
safety_assured { add_column :accounts, :kobold, :boolean, null: false, default: false }
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
class AdultsOnlyToAdultContent < ActiveRecord::Migration[5.2]
|
||||||
|
def up
|
||||||
|
safety_assured { rename_column :accounts, :adults_only, :adult_content }
|
||||||
|
end
|
||||||
|
def down
|
||||||
|
safety_assured { rename_column :accounts, :adult_content, :adults_only }
|
||||||
|
end
|
||||||
|
end
|
|
@ -148,9 +148,12 @@ ActiveRecord::Schema.define(version: 2019_05_21_003909) do
|
||||||
t.boolean "unlisted", default: false, null: false
|
t.boolean "unlisted", default: false, null: false
|
||||||
t.boolean "force_unlisted", default: false, null: false
|
t.boolean "force_unlisted", default: false, null: false
|
||||||
t.boolean "force_sensitive", default: false, null: false
|
t.boolean "force_sensitive", default: false, null: false
|
||||||
t.boolean "adults_only", default: false, null: false
|
t.boolean "adult_content", default: false, null: false
|
||||||
t.datetime "silenced_at"
|
t.datetime "silenced_at"
|
||||||
t.datetime "suspended_at"
|
t.datetime "suspended_at"
|
||||||
|
t.boolean "supports_chat", default: false, null: false
|
||||||
|
t.boolean "gently", default: false, null: false
|
||||||
|
t.boolean "kobold", default: false, null: false
|
||||||
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