Merge remote-tracking branch 'parent/stable-4.3' into kb-draft-15.12-lts
This commit is contained in:
commit
97647cbbc0
108 changed files with 1729 additions and 1018 deletions
|
@ -157,7 +157,7 @@ class Account < ApplicationRecord
|
|||
scope :not_excluded_by_account, ->(account) { where.not(id: account.excluded_from_timeline_account_ids) }
|
||||
scope :not_domain_blocked_by_account, ->(account) { where(arel_table[:domain].eq(nil).or(arel_table[:domain].not_in(account.excluded_from_timeline_domains))) }
|
||||
scope :dormant, -> { joins(:account_stat).merge(AccountStat.without_recent_activity) }
|
||||
scope :with_username, ->(value) { where arel_table[:username].lower.eq(value.to_s.downcase) }
|
||||
scope :with_username, ->(value) { value.is_a?(Array) ? where(arel_table[:username].lower.in(value.map { |x| x.to_s.downcase })) : where(arel_table[:username].lower.eq(value.to_s.downcase)) }
|
||||
scope :with_domain, ->(value) { where arel_table[:domain].lower.eq(value&.to_s&.downcase) }
|
||||
scope :without_memorial, -> { where(memorial: false) }
|
||||
scope :duplicate_uris, -> { select(:uri, Arel.star.count).group(:uri).having(Arel.star.count.gt(1)) }
|
||||
|
|
|
@ -73,7 +73,14 @@ class Account::Field < ActiveModelSerializers::Model
|
|||
end
|
||||
|
||||
def extract_url_from_html
|
||||
doc = Nokogiri::HTML5.fragment(value)
|
||||
begin
|
||||
doc = Nokogiri::HTML5.fragment(value)
|
||||
rescue ArgumentError
|
||||
# This can happen if one of the Nokogumbo limits is encountered
|
||||
# Unfortunately, it does not use a more precise error class
|
||||
# nor allows more graceful handling
|
||||
return
|
||||
end
|
||||
|
||||
return if doc.nil?
|
||||
return if doc.children.size != 1
|
||||
|
|
|
@ -425,8 +425,10 @@ class MediaAttachment < ApplicationRecord
|
|||
|
||||
@paths_to_cache_bust = MediaAttachment.attachment_definitions.keys.flat_map do |attachment_name|
|
||||
attachment = public_send(attachment_name)
|
||||
next if attachment.blank?
|
||||
|
||||
styles = DEFAULT_STYLES | attachment.styles.keys
|
||||
styles.map { |style| attachment.path(style) }
|
||||
styles.map { |style| attachment.url(style) }
|
||||
end.compact
|
||||
rescue => e
|
||||
# We really don't want any error here preventing media deletion
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue