Skip to content

Commit

Permalink
Fix processing poll Updates (mastodon#10333)
Browse files Browse the repository at this point in the history
ActivityPub::ProcessPollService was checking the JSON-LD context although
it was passed only the `Question` object embedded in the `Update` activity.
  • Loading branch information
ClearlyClaire authored and hiyuki2578 committed Oct 2, 2019
1 parent adec2c4 commit 0062b1f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/services/activitypub/fetch_remote_poll_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class ActivityPub::FetchRemotePollService < BaseService

def call(poll, on_behalf_of = nil)
json = fetch_resource(poll.status.uri, true, on_behalf_of)
return unless supported_context?(json)
ActivityPub::ProcessPollService.new.call(poll, json)
end
end
6 changes: 1 addition & 5 deletions app/services/activitypub/process_poll_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ActivityPub::ProcessPollService < BaseService

def call(poll, json)
@json = json
return unless supported_context? && expected_type?
return unless expected_type?

previous_expires_at = poll.expires_at

Expand Down Expand Up @@ -54,10 +54,6 @@ def call(poll, json)

private

def supported_context?
super(@json)
end

def expected_type?
equals_or_includes_any?(@json['type'], %w(Question))
end
Expand Down

0 comments on commit 0062b1f

Please sign in to comment.