Merge branch 'main' into glitch-soc/merge-upstream

Conflicts:
- `app/models/status.rb`:
  Minor upstream refactor moved hook definitions around,
  and glitch-soc has an extra `before_create`.
  Moved the `before_create` accordingly.
- `app/services/batched_remove_status_service.rb`:
  Minor upstream refactor changed a block in which glitch-soc
  had one extra call to handle direct timelines.
  Adapted changes to keep glitch-soc's extra call.
This commit is contained in:
Claire
2023-01-12 10:15:46 +01:00
144 changed files with 1747 additions and 1538 deletions

View File

@@ -20,7 +20,7 @@ class BatchedRemoveStatusService < BaseService
ActiveRecord::Associations::Preloader.new.preload(statuses_with_account_conversations, [mentions: :account])
statuses_with_account_conversations.each do |status|
status.send(:unlink_from_conversations)
status.unlink_from_conversations!
unpush_from_direct_timelines(status)
end

View File

@@ -26,7 +26,7 @@ class VerifyLinkService < BaseService
def link_back_present?
return false if @body.blank?
links = Nokogiri::HTML(@body).xpath('//a[contains(concat(" ", normalize-space(@rel), " "), " me ")]|//link[contains(concat(" ", normalize-space(@rel), " "), " me ")]')
links = Nokogiri::HTML5(@body).xpath('//a[contains(concat(" ", normalize-space(@rel), " "), " me ")]|//link[contains(concat(" ", normalize-space(@rel), " "), " me ")]')
if links.any? { |link| link['href']&.downcase == @link_back.downcase }
true