From 230a012f0090c496fc5cdb011bcc8ed732fd0f5c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 3 Mar 2019 22:18:23 +0100 Subject: Add polls (#10111) * Add polls Fix #1629 * Add tests * Fixes * Change API for creating polls * Use name instead of content for votes * Remove poll validation for remote polls * Add polls to public pages * When updating the poll, update options just in case they were changed * Fix public pages showing both poll and other media --- app/policies/poll_policy.rb | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 app/policies/poll_policy.rb (limited to 'app/policies') diff --git a/app/policies/poll_policy.rb b/app/policies/poll_policy.rb new file mode 100644 index 000000000..0d839f240 --- /dev/null +++ b/app/policies/poll_policy.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class PollPolicy < ApplicationPolicy + def vote? + !current_account.blocking?(record.account) && !record.account.blocking?(current_account) + end +end -- cgit From 7a25bb858a2a7f3662d2ad2a8cba9ac7ea141aca Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 4 Mar 2019 22:47:47 +0100 Subject: Ensure only people allowed to see the poll can actually vote (#10161) --- app/policies/poll_policy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/policies') diff --git a/app/policies/poll_policy.rb b/app/policies/poll_policy.rb index 0d839f240..9d69eb5bb 100644 --- a/app/policies/poll_policy.rb +++ b/app/policies/poll_policy.rb @@ -2,6 +2,6 @@ class PollPolicy < ApplicationPolicy def vote? - !current_account.blocking?(record.account) && !record.account.blocking?(current_account) + StatusPolicy.new(current_account, record.status).show? && !current_account.blocking?(record.account) && !record.account.blocking?(current_account) end end -- cgit