Fix poll update handler calling method was that was not available (#10246)
* Fix poll update handler calling method was that was not available Fix regression from #10209 * Refactor VoteService * Refactor ActivityPub::DistributePollUpdateWorker and optimize it * Fix typo * Fix typo
This commit is contained in:
@ -4,8 +4,11 @@ class ActivityPub::Activity::Update < ActivityPub::Activity
|
||||
SUPPORTED_TYPES = %w(Application Group Organization Person Service).freeze
|
||||
|
||||
def perform
|
||||
update_account if equals_or_includes_any?(@object['type'], SUPPORTED_TYPES)
|
||||
update_poll if equals_or_includes_any?(@object['type'], %w(Question))
|
||||
if equals_or_includes_any?(@object['type'], SUPPORTED_TYPES)
|
||||
update_account
|
||||
elsif equals_or_includes_any?(@object['type'], %w(Question))
|
||||
update_poll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
@ -18,11 +21,10 @@ class ActivityPub::Activity::Update < ActivityPub::Activity
|
||||
|
||||
def update_poll
|
||||
return reject_payload! if invalid_origin?(@object['id'])
|
||||
status = Status.find_by(uri: object_uri, account_id: @account.id)
|
||||
return if status.nil? || status.poll_id.nil?
|
||||
poll = Poll.find(status.poll_id)
|
||||
return if poll.nil?
|
||||
|
||||
ActivityPub::ProcessPollService.new.call(poll, @object)
|
||||
status = Status.find_by(uri: object_uri, account_id: @account.id)
|
||||
return if status.nil? || status.poll.nil?
|
||||
|
||||
ActivityPub::ProcessPollService.new.call(status.poll, @object)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user