Merge commit 'ea10febd257b5b729a50aeb3218389763f5f4b97' into glitch-soc/merge-upstream
This commit is contained in:
@@ -133,8 +133,12 @@ class AccountSearchService < BaseService
|
||||
end
|
||||
|
||||
def must_clause
|
||||
fields = %w(username username.* display_name display_name.*)
|
||||
fields << 'text' << 'text.*' if options[:use_searchable_text]
|
||||
if options[:start_with_hashtag]
|
||||
fields = %w(text text.*)
|
||||
else
|
||||
fields = %w(username username.* display_name display_name.*)
|
||||
fields << 'text' << 'text.*' if options[:use_searchable_text]
|
||||
end
|
||||
|
||||
[
|
||||
{
|
||||
|
@@ -76,6 +76,9 @@ class ActivityPub::ProcessAccountService < BaseService
|
||||
@account.suspended_at = domain_block.created_at if auto_suspend?
|
||||
@account.suspension_origin = :local if auto_suspend?
|
||||
@account.silenced_at = domain_block.created_at if auto_silence?
|
||||
|
||||
set_immediate_protocol_attributes!
|
||||
|
||||
@account.save
|
||||
end
|
||||
|
||||
|
@@ -162,7 +162,12 @@ class NotifyService < BaseService
|
||||
end
|
||||
|
||||
def send_email!
|
||||
NotificationMailer.public_send(@notification.type, @recipient, @notification).deliver_later(wait: 2.minutes) if NotificationMailer.respond_to?(@notification.type)
|
||||
return unless NotificationMailer.respond_to?(@notification.type)
|
||||
|
||||
NotificationMailer
|
||||
.with(recipient: @recipient, notification: @notification)
|
||||
.public_send(@notification.type)
|
||||
.deliver_later(wait: 2.minutes)
|
||||
end
|
||||
|
||||
def email_needed?
|
||||
|
@@ -16,7 +16,11 @@ class ReportService < BaseService
|
||||
|
||||
create_report!
|
||||
notify_staff!
|
||||
forward_to_origin! if forward?
|
||||
|
||||
if forward?
|
||||
forward_to_origin!
|
||||
forward_to_replied_to!
|
||||
end
|
||||
|
||||
@report
|
||||
end
|
||||
@@ -29,7 +33,7 @@ class ReportService < BaseService
|
||||
status_ids: reported_status_ids,
|
||||
comment: @comment,
|
||||
uri: @options[:uri],
|
||||
forwarded: forward?,
|
||||
forwarded: forward_to_origin?,
|
||||
category: @category,
|
||||
rule_ids: @rule_ids
|
||||
)
|
||||
@@ -45,11 +49,15 @@ class ReportService < BaseService
|
||||
end
|
||||
|
||||
def forward_to_origin!
|
||||
return unless forward_to_origin?
|
||||
|
||||
# Send report to the server where the account originates from
|
||||
ActivityPub::DeliveryWorker.perform_async(payload, some_local_account.id, @target_account.inbox_url)
|
||||
end
|
||||
|
||||
def forward_to_replied_to!
|
||||
# Send report to servers to which the account was replying to, so they also have a chance to act
|
||||
inbox_urls = Account.remote.where(id: Status.where(id: reported_status_ids).where.not(in_reply_to_account_id: nil).select(:in_reply_to_account_id)).inboxes - [@target_account.inbox_url]
|
||||
inbox_urls = Account.remote.where(domain: forward_to_domains).where(id: Status.where(id: reported_status_ids).where.not(in_reply_to_account_id: nil).select(:in_reply_to_account_id)).inboxes - [@target_account.inbox_url]
|
||||
|
||||
inbox_urls.each do |inbox_url|
|
||||
ActivityPub::DeliveryWorker.perform_async(payload, some_local_account.id, inbox_url)
|
||||
@@ -60,6 +68,14 @@ class ReportService < BaseService
|
||||
!@target_account.local? && ActiveModel::Type::Boolean.new.cast(@options[:forward])
|
||||
end
|
||||
|
||||
def forward_to_origin?
|
||||
forward? && forward_to_domains.include?(@target_account.domain)
|
||||
end
|
||||
|
||||
def forward_to_domains
|
||||
@forward_to_domains ||= (@options[:forward_to_domains] || [@target_account.domain]).filter_map { |domain| TagManager.instance.normalize_domain(domain&.strip) }.uniq
|
||||
end
|
||||
|
||||
def reported_status_ids
|
||||
return AccountStatusesFilter.new(@target_account, @source_account).results.with_discarded.find(Array(@status_ids)).pluck(:id) if @source_account.local?
|
||||
|
||||
|
@@ -33,7 +33,8 @@ class SearchService < BaseService
|
||||
resolve: @resolve,
|
||||
offset: @offset,
|
||||
use_searchable_text: true,
|
||||
following: @following
|
||||
following: @following,
|
||||
start_with_hashtag: @query.start_with?('#')
|
||||
)
|
||||
end
|
||||
|
||||
@@ -91,11 +92,11 @@ class SearchService < BaseService
|
||||
def full_text_searchable?
|
||||
return false unless Chewy.enabled?
|
||||
|
||||
statuses_search? && !@account.nil? && !((@query.start_with?('#') || @query.include?('@')) && !@query.include?(' '))
|
||||
statuses_search? && !@account.nil? && !(@query.include?('@') && !@query.include?(' '))
|
||||
end
|
||||
|
||||
def account_searchable?
|
||||
account_search? && !(@query.start_with?('#') || (@query.include?('@') && @query.include?(' ')))
|
||||
account_search? && !(@query.include?('@') && @query.include?(' '))
|
||||
end
|
||||
|
||||
def hashtag_searchable?
|
||||
|
Reference in New Issue
Block a user