FIX: properly secure poll message bus

Co-authored-by: Sam <sam.saffron@gmail.com>
This commit is contained in:
Régis Hanol
2018-12-05 21:27:49 +01:00
parent 8aff99761a
commit aea2d8bbeb
4 changed files with 76 additions and 18 deletions

View File

@ -91,7 +91,7 @@ module DiscoursePoll
if has_changed
polls = ::Poll.includes(poll_options: :poll_votes).where(post: post)
polls = ActiveModel::ArraySerializer.new(polls, each_serializer: PollSerializer, root: false).as_json
MessageBus.publish("/polls/#{post.topic_id}", post_id: post.id, polls: polls)
post.publish_message!("/polls/#{post.topic_id}", post_id: post.id, polls: polls)
end
end
end