about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-09-22 14:15:18 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-09-22 14:15:18 +0200
commitb359974d9b356bb723fe046466b178328cf9bbaf (patch)
treebf8cb3887286aaced76a46ab80c7e250afbb763e /app/models
parent26b810561a5b7cfd1766699358d998b5882a5876 (diff)
Show user what options they have voted (#11195)
* Add own_votes field to poll results in REST API

Fixes #10679

* Display user votes in WebUI

* Update styling

* Add vote checkmark to public pages
Diffstat (limited to 'app/models')
-rw-r--r--app/models/poll.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/poll.rb b/app/models/poll.rb
index 8f72c7b11..55a8f13a6 100644
--- a/app/models/poll.rb
+++ b/app/models/poll.rb
@@ -54,6 +54,10 @@ class Poll < ApplicationRecord
     account.id == account_id || votes.where(account: account).exists?
   end
 
+  def own_votes(account)
+    votes.where(account: account).pluck(:choice)
+  end
+
   delegate :local?, to: :account
 
   def remote?