Fix status reference worker parameters error
This commit is contained in:
parent
22ad776635
commit
ad5f9492fb
6 changed files with 8 additions and 9 deletions
|
@ -473,9 +473,8 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
end
|
||||
|
||||
def process_references!
|
||||
references = []
|
||||
references = ActivityPub::FetchReferencesService(@json['references']) unless @json['references'].nil?
|
||||
ProcessReferencesWorker.perform_async(@status.id, [], urls: references)
|
||||
ActivityPub::FetchReferencesService(@json['references']) unless @json['references'].nil?
|
||||
ProcessReferencesWorker.perform_async(@status.id, [], [])
|
||||
end
|
||||
|
||||
def join_group!
|
||||
|
|
|
@ -48,7 +48,7 @@ class StatusStat < ApplicationRecord
|
|||
end
|
||||
|
||||
def status_referred_by_count
|
||||
[attributes['status_referred_by_count'], 0].max
|
||||
[attributes['status_referred_by_count'] || 0, 0].max
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -148,7 +148,7 @@ class PostStatusService < BaseService
|
|||
|
||||
def postprocess_status!
|
||||
process_hashtags_service.call(@status)
|
||||
ProcessReferencesWorker.perform_async(@status.id, @reference_ids)
|
||||
ProcessReferencesWorker.perform_async(@status.id, @reference_ids, [])
|
||||
Trends.tags.register(@status)
|
||||
LinkCrawlWorker.perform_async(@status.id)
|
||||
DistributionWorker.perform_async(@status.id)
|
||||
|
|
|
@ -44,7 +44,7 @@ class ProcessReferencesService < BaseService
|
|||
end
|
||||
|
||||
def scan_text!
|
||||
text = @status.text.gsub(%r{</?[^>]*>}, '')
|
||||
text = @status.text.gsub('\u003c', '<').gsub('\u003e', '>').gsub(%r{</?[^>]*>}, '')
|
||||
@scan_text = fetch_statuses!(text.scan(REFURL_EXP).pluck(3).uniq).map(&:id).uniq.filter { |status_id| !status_id.zero? }
|
||||
end
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ class UpdateStatusService < BaseService
|
|||
def update_metadata!
|
||||
ProcessHashtagsService.new.call(@status)
|
||||
ProcessMentionsService.new.call(@status)
|
||||
ProcessReferencesWorker.perform_async(@status.id, (@options[:status_reference_ids] || []).map(&:to_i).filter(&:positive?))
|
||||
ProcessReferencesWorker.perform_async(@status.id, (@options[:status_reference_ids] || []).map(&:to_i).filter(&:positive?), [])
|
||||
end
|
||||
|
||||
def broadcast_updates!
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
class ProcessReferencesWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(status_id, ids, urls: nil)
|
||||
ProcessReferencesService.new.call(Status.find(status_id), ids || [], urls: urls)
|
||||
def perform(status_id, ids, urls)
|
||||
ProcessReferencesService.new.call(Status.find(status_id), ids || [], urls: urls || [])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue