Merge commit '90ec88d58b' into kb_migration

This commit is contained in:
KMY 2023-08-15 18:20:19 +09:00
commit 993bced956
5 changed files with 22 additions and 1 deletions

View file

@ -20,6 +20,7 @@ module ContextHelper
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' } },
blurhash: { 'toot' => 'http://joinmastodon.org/ns#', 'blurhash' => 'toot:blurhash' }, blurhash: { 'toot' => 'http://joinmastodon.org/ns#', 'blurhash' => 'toot:blurhash' },
discoverable: { 'toot' => 'http://joinmastodon.org/ns#', 'discoverable' => 'toot:discoverable' }, discoverable: { 'toot' => 'http://joinmastodon.org/ns#', 'discoverable' => 'toot:discoverable' },
indexable: { 'toot' => 'http://joinmastodon.org/ns#', 'indexable' => 'toot:indexable' },
voters_count: { 'toot' => 'http://joinmastodon.org/ns#', 'votersCount' => 'toot:votersCount' }, voters_count: { 'toot' => 'http://joinmastodon.org/ns#', 'votersCount' => 'toot:votersCount' },
emoji_reactions: { 'fedibird' => 'http://fedibird.com/ns#', 'emojiReactions' => { '@id' => 'fedibird:emojiReactions', '@type' => '@id' } }, 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' } }, searchable_by: { 'fedibird' => 'http://fedibird.com/ns#', 'searchableBy' => { '@id' => 'fedibird:searchableBy', '@type' => '@id' } },

View file

@ -54,6 +54,7 @@
# searchability :integer default("direct"), not null # searchability :integer default("direct"), not null
# dissubscribable :boolean default(FALSE), not null # dissubscribable :boolean default(FALSE), not null
# settings :jsonb # settings :jsonb
# indexable :boolean default(FALSE), not null
# #
class Account < ApplicationRecord class Account < ApplicationRecord

View file

@ -123,6 +123,7 @@ class ActivityPub::ProcessAccountService < BaseService
@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.discoverable = @json['discoverable'] || false @account.discoverable = @json['discoverable'] || false
@account.indexable = @json['indexable'] || false
@account.searchability = searchability_from_audience @account.searchability = searchability_from_audience
@account.dissubscribable = !subscribable(@account.note) @account.dissubscribable = !subscribable(@account.note)
@account.settings = other_settings @account.settings = other_settings

View file

@ -0,0 +1,17 @@
# frozen_string_literal: true
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
class AddIndexableToAccounts < ActiveRecord::Migration[7.0]
include Mastodon::MigrationHelpers
disable_ddl_transaction!
def up
safety_assured { add_column_with_default :accounts, :indexable, :boolean, default: false, allow_null: false }
end
def down
remove_column :accounts, :indexable
end
end

View file

@ -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[7.0].define(version: 2023_08_12_130612) do ActiveRecord::Schema[7.0].define(version: 2023_08_14_223300) 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"
@ -192,6 +192,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_08_12_130612) do
t.integer "searchability", default: 2, null: false t.integer "searchability", default: 2, null: false
t.boolean "dissubscribable", default: false, null: false t.boolean "dissubscribable", default: false, null: false
t.jsonb "settings" t.jsonb "settings"
t.boolean "indexable", 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), COALESCE(lower((domain)::text), ''::text)", name: "index_accounts_on_username_and_domain_lower", unique: true t.index "lower((username)::text), COALESCE(lower((domain)::text), ''::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
t.index ["domain", "id"], name: "index_accounts_on_domain_and_id" t.index ["domain", "id"], name: "index_accounts_on_domain_and_id"