Merge remote-tracking branch 'parent/main' into upstream-20240906
This commit is contained in:
commit
218cb37fe3
176 changed files with 750 additions and 603 deletions
|
@ -79,6 +79,8 @@ class Account < ApplicationRecord
|
|||
DISPLAY_NAME_LENGTH_LIMIT = 30
|
||||
NOTE_LENGTH_LIMIT = 500
|
||||
|
||||
AUTOMATED_ACTOR_TYPES = %w(Application Service).freeze
|
||||
|
||||
include Attachmentable # Load prior to Avatar & Header concerns
|
||||
|
||||
include Account::Associations
|
||||
|
@ -135,7 +137,8 @@ class Account < ApplicationRecord
|
|||
scope :without_silenced, -> { where(silenced_at: nil) }
|
||||
scope :without_instance_actor, -> { where.not(id: INSTANCE_ACTOR_ID) }
|
||||
scope :recent, -> { reorder(id: :desc) }
|
||||
scope :bots, -> { where(actor_type: %w(Application Service)) }
|
||||
scope :bots, -> { where(actor_type: AUTOMATED_ACTOR_TYPES) }
|
||||
scope :non_automated, -> { where.not(actor_type: AUTOMATED_ACTOR_TYPES) }
|
||||
scope :groups, -> { where(actor_type: 'Group') }
|
||||
scope :alphabetic, -> { order(domain: :asc, username: :asc) }
|
||||
scope :matches_uri_prefix, ->(value) { where(arel_table[:uri].matches("#{sanitize_sql_like(value)}/%", false, true)).or(where(uri: value)) }
|
||||
|
@ -191,7 +194,7 @@ class Account < ApplicationRecord
|
|||
end
|
||||
|
||||
def bot?
|
||||
%w(Application Service).include? actor_type
|
||||
AUTOMATED_ACTOR_TYPES.include?(actor_type)
|
||||
end
|
||||
|
||||
def instance_actor?
|
||||
|
|
|
@ -73,10 +73,10 @@ class Account::Field < ActiveModelSerializers::Model
|
|||
end
|
||||
|
||||
def extract_url_from_html
|
||||
doc = Nokogiri::HTML(value).at_xpath('//body')
|
||||
doc = Nokogiri::HTML5.fragment(value)
|
||||
|
||||
return if doc.nil?
|
||||
return if doc.children.size > 1
|
||||
return if doc.children.size != 1
|
||||
|
||||
element = doc.children.first
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class AccountModerationNote < ApplicationRecord
|
|||
belongs_to :account
|
||||
belongs_to :target_account, class_name: 'Account'
|
||||
|
||||
scope :latest, -> { reorder('created_at DESC') }
|
||||
scope :chronological, -> { reorder(id: :asc) }
|
||||
|
||||
validates :content, presence: true, length: { maximum: CONTENT_SIZE_LIMIT }
|
||||
end
|
||||
|
|
|
@ -73,6 +73,14 @@ class Admin::AccountAction
|
|||
end
|
||||
end
|
||||
|
||||
def disabled_types_for_account(account)
|
||||
if account.suspended?
|
||||
%w(silence suspend)
|
||||
elsif account.silenced?
|
||||
%w(silence)
|
||||
end
|
||||
end
|
||||
|
||||
def i18n_scope
|
||||
:activerecord
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ class ReportNote < ApplicationRecord
|
|||
belongs_to :account
|
||||
belongs_to :report, inverse_of: :notes, touch: true
|
||||
|
||||
scope :latest, -> { reorder(created_at: :desc) }
|
||||
scope :chronological, -> { reorder(id: :asc) }
|
||||
|
||||
validates :content, presence: true, length: { maximum: CONTENT_SIZE_LIMIT }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue