Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure the poll is created before storing its id #10142

Merged
merged 3 commits into from Mar 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/status.rb
Expand Up @@ -255,7 +255,7 @@ def decrement_count!(key)
before_validation :set_conversation
before_validation :set_local

before_save :set_poll_id
after_create :set_poll_id

class << self
def selectable_visibilities
Expand Down Expand Up @@ -446,7 +446,7 @@ def set_reblog
end

def set_poll_id
self.poll_id = owned_poll.id unless owned_poll.nil?
update_column(:poll_id, owned_poll.id) unless owned_poll.nil?
end

def set_visibility
Expand Down
2 changes: 1 addition & 1 deletion app/services/activitypub/fetch_remote_poll_service.rb
Expand Up @@ -46,6 +46,6 @@ def supported_context?
end

def expected_type?
equals_or_includes_any?(@json['type'], 'Question')
equals_or_includes_any?(@json['type'], %w(Question))
end
end
2 changes: 1 addition & 1 deletion app/services/resolve_url_service.rb
Expand Up @@ -20,7 +20,7 @@ def call(url, on_behalf_of: nil)
def process_url
if equals_or_includes_any?(type, %w(Application Group Organization Person Service))
FetchRemoteAccountService.new.call(atom_url, body, protocol)
elsif equals_or_includes_any?(type, %w(Note Article Image Video Page))
elsif equals_or_includes_any?(type, %w(Note Article Image Video Page Question))
FetchRemoteStatusService.new.call(atom_url, body, protocol)
end
end
Expand Down