mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
Add rubocop to our build. (#5004)
This commit is contained in:
@ -101,7 +101,7 @@ module DiscoursePoll
|
||||
post.save_custom_fields(true)
|
||||
|
||||
# publish the changes
|
||||
MessageBus.publish("/polls/#{post.topic_id}", { post_id: post.id, polls: polls })
|
||||
MessageBus.publish("/polls/#{post.topic_id}", post_id: post.id, polls: polls)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,9 +27,9 @@ desc "Migrate old polls to new syntax"
|
||||
task "poll:migrate_old_polls" => :environment do
|
||||
# iterate over all polls
|
||||
PluginStoreRow.where(plugin_name: "poll")
|
||||
.where("key LIKE 'poll_options_%'")
|
||||
.pluck(:key)
|
||||
.each do |poll_options_key|
|
||||
.where("key LIKE 'poll_options_%'")
|
||||
.pluck(:key)
|
||||
.each do |poll_options_key|
|
||||
# extract the post_id
|
||||
post_id = poll_options_key["poll_options_".length..-1].to_i
|
||||
# load the post from the db
|
||||
@ -56,9 +56,9 @@ task "poll:migrate_old_polls" => :environment do
|
||||
options = post.custom_fields["polls"]["poll"]["options"]
|
||||
# iterate over all votes
|
||||
PluginStoreRow.where(plugin_name: "poll")
|
||||
.where("key LIKE 'poll_vote_#{post_id}_%'")
|
||||
.pluck(:key, :value)
|
||||
.each do |poll_vote_key, vote|
|
||||
.where("key LIKE 'poll_vote_#{post_id}_%'")
|
||||
.pluck(:key, :value)
|
||||
.each do |poll_vote_key, vote|
|
||||
# extract the user_id
|
||||
user_id = poll_vote_key["poll_vote_#{post_id}_%".length..-1].to_i
|
||||
# find the selected option
|
||||
|
Reference in New Issue
Block a user