From bdffab7d7248fc628f14c694a4f8b7b11366db39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Sat, 7 Oct 2017 16:56:35 +0200 Subject: [PATCH 1/2] Fixed already-answered logic Added condition to check if user is unverified to avoid showing the ui element that lets users know they already voted a poll. --- app/views/polls/_poll_group.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/polls/_poll_group.html.erb b/app/views/polls/_poll_group.html.erb index 380b35fc7..b9cbb3c95 100644 --- a/app/views/polls/_poll_group.html.erb +++ b/app/views/polls/_poll_group.html.erb @@ -1,6 +1,6 @@ <% poll_group.each do |poll| %>
- <% if user_signed_in? && !poll.votable_by?(current_user) %> + <% if user_signed_in? && !current_user.unverified? && !poll.votable_by?(current_user) %>
"> <%= t("polls.index.already_answer") %>
From b19953b38f531374cb5ac1d0692c30492daba7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Sat, 7 Oct 2017 17:06:53 +0200 Subject: [PATCH 2/2] Added tests --- spec/features/polls/polls_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/features/polls/polls_spec.rb b/spec/features/polls/polls_spec.rb index 8f7a9b2de..faaadc548 100644 --- a/spec/features/polls/polls_spec.rb +++ b/spec/features/polls/polls_spec.rb @@ -94,6 +94,9 @@ feature 'Polls' do end scenario 'Level 1 users' do + visit polls_path + expect(page).to_not have_selector('.already-answer') + poll.update(geozone_restricted: true) poll.geozones << geozone