Add following_url to accounts (#36093)
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
# outbox_url :string default(""), not null
|
# outbox_url :string default(""), not null
|
||||||
# shared_inbox_url :string default(""), not null
|
# shared_inbox_url :string default(""), not null
|
||||||
# followers_url :string default(""), not null
|
# followers_url :string default(""), not null
|
||||||
|
# following_url :string default(""), not null
|
||||||
# protocol :integer default("ostatus"), not null
|
# protocol :integer default("ostatus"), not null
|
||||||
# memorial :boolean default(FALSE), not null
|
# memorial :boolean default(FALSE), not null
|
||||||
# moved_to_account_id :bigint(8)
|
# moved_to_account_id :bigint(8)
|
||||||
@@ -123,6 +124,7 @@ class Account < ApplicationRecord
|
|||||||
validates_with EmptyProfileFieldNamesValidator, if: -> { local? && will_save_change_to_fields? }
|
validates_with EmptyProfileFieldNamesValidator, if: -> { local? && will_save_change_to_fields? }
|
||||||
with_options on: :create, if: :local? do
|
with_options on: :create, if: :local? do
|
||||||
validates :followers_url, absence: true
|
validates :followers_url, absence: true
|
||||||
|
validates :following_url, absence: true
|
||||||
validates :inbox_url, absence: true
|
validates :inbox_url, absence: true
|
||||||
validates :shared_inbox_url, absence: true
|
validates :shared_inbox_url, absence: true
|
||||||
validates :uri, absence: true
|
validates :uri, absence: true
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||||||
@account.outbox_url = valid_collection_uri(@json['outbox'])
|
@account.outbox_url = valid_collection_uri(@json['outbox'])
|
||||||
@account.shared_inbox_url = valid_collection_uri(@json['endpoints'].is_a?(Hash) ? @json['endpoints']['sharedInbox'] : @json['sharedInbox'])
|
@account.shared_inbox_url = valid_collection_uri(@json['endpoints'].is_a?(Hash) ? @json['endpoints']['sharedInbox'] : @json['sharedInbox'])
|
||||||
@account.followers_url = valid_collection_uri(@json['followers'])
|
@account.followers_url = valid_collection_uri(@json['followers'])
|
||||||
|
@account.following_url = valid_collection_uri(@json['following'])
|
||||||
@account.url = url || @uri
|
@account.url = url || @uri
|
||||||
@account.uri = @uri
|
@account.uri = @uri
|
||||||
@account.actor_type = actor_type
|
@account.actor_type = actor_type
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AddFollowingURLToAccounts < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
add_column :accounts, :following_url, :string, default: '', null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -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[8.0].define(version: 2025_09_11_163952) do
|
ActiveRecord::Schema[8.0].define(version: 2025_09_12_082651) 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 "pg_catalog.plpgsql"
|
enable_extension "pg_catalog.plpgsql"
|
||||||
|
|
||||||
@@ -198,6 +198,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_11_163952) do
|
|||||||
t.datetime "requested_review_at", precision: nil
|
t.datetime "requested_review_at", precision: nil
|
||||||
t.boolean "indexable", default: false, null: false
|
t.boolean "indexable", default: false, null: false
|
||||||
t.string "attribution_domains", default: [], array: true
|
t.string "attribution_domains", default: [], array: true
|
||||||
|
t.string "following_url", default: "", 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"
|
||||||
|
|||||||
Reference in New Issue
Block a user