diff --git a/plugin.rb b/plugin.rb index 44be931..3681dda 100755 --- a/plugin.rb +++ b/plugin.rb @@ -179,8 +179,9 @@ class Engine < ::Rails::Engine moved_votes = 0 duplicated_votes = 0 - if orig.who_voted.present? && orig.closed - orig.who_voted.each do |user| + who_voted = orig.votes.map(&:user) + if who_voted.present? && orig.closed + who_voted.each do |user| next if user.blank? user_votes = user.topics_with_vote.pluck(:topic_id) diff --git a/spec/voting_spec.rb b/spec/voting_spec.rb index 401faec..0b06fbf 100644 --- a/spec/voting_spec.rb +++ b/spec/voting_spec.rb @@ -36,6 +36,9 @@ let(:users) { [user0, user1, user2, user3, user4, user5] } before do + # ensure merging votes works regardless of voters' visibility + SiteSetting.voting_show_who_voted = false + Fabricate(:post, topic: topic0, user: user0) Fabricate(:post, topic: topic0, user: user0)