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
|
end
|
||||||
|
|
||||||
def process_references!
|
def process_references!
|
||||||
references = []
|
ActivityPub::FetchReferencesService(@json['references']) unless @json['references'].nil?
|
||||||
references = ActivityPub::FetchReferencesService(@json['references']) unless @json['references'].nil?
|
ProcessReferencesWorker.perform_async(@status.id, [], [])
|
||||||
ProcessReferencesWorker.perform_async(@status.id, [], urls: references)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def join_group!
|
def join_group!
|
||||||
|
|
|
@ -48,7 +48,7 @@ class StatusStat < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def status_referred_by_count
|
def status_referred_by_count
|
||||||
[attributes['status_referred_by_count'], 0].max
|
[attributes['status_referred_by_count'] || 0, 0].max
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -148,7 +148,7 @@ class PostStatusService < BaseService
|
||||||
|
|
||||||
def postprocess_status!
|
def postprocess_status!
|
||||||
process_hashtags_service.call(@status)
|
process_hashtags_service.call(@status)
|
||||||
ProcessReferencesWorker.perform_async(@status.id, @reference_ids)
|
ProcessReferencesWorker.perform_async(@status.id, @reference_ids, [])
|
||||||
Trends.tags.register(@status)
|
Trends.tags.register(@status)
|
||||||
LinkCrawlWorker.perform_async(@status.id)
|
LinkCrawlWorker.perform_async(@status.id)
|
||||||
DistributionWorker.perform_async(@status.id)
|
DistributionWorker.perform_async(@status.id)
|
||||||
|
|
|
@ -44,7 +44,7 @@ class ProcessReferencesService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def scan_text!
|
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? }
|
@scan_text = fetch_statuses!(text.scan(REFURL_EXP).pluck(3).uniq).map(&:id).uniq.filter { |status_id| !status_id.zero? }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ class UpdateStatusService < BaseService
|
||||||
def update_metadata!
|
def update_metadata!
|
||||||
ProcessHashtagsService.new.call(@status)
|
ProcessHashtagsService.new.call(@status)
|
||||||
ProcessMentionsService.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
|
end
|
||||||
|
|
||||||
def broadcast_updates!
|
def broadcast_updates!
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
class ProcessReferencesWorker
|
class ProcessReferencesWorker
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
||||||
def perform(status_id, ids, urls: nil)
|
def perform(status_id, ids, urls)
|
||||||
ProcessReferencesService.new.call(Status.find(status_id), ids || [], urls: urls)
|
ProcessReferencesService.new.call(Status.find(status_id), ids || [], urls: urls || [])
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue