diff options
author | ThibG <thib@sitedethib.com> | 2019-03-08 01:47:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-08 01:47:36 +0100 |
commit | 29a09858f6700c0a6eb17797836589ed0839dec9 (patch) | |
tree | 96ac7fbac23d6ca32704c143342b5606523c8cab /app/serializers/rest/poll_serializer.rb | |
parent | 38e9c66f34d7054357a3de63834f182734d43d75 (diff) | |
parent | ca45198ccbbdde88731f074fcab2b5c9310775c2 (diff) |
Merge pull request #945 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/serializers/rest/poll_serializer.rb')
-rw-r--r-- | app/serializers/rest/poll_serializer.rb | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/app/serializers/rest/poll_serializer.rb b/app/serializers/rest/poll_serializer.rb index b02e8ca93..4dae1c09f 100644 --- a/app/serializers/rest/poll_serializer.rb +++ b/app/serializers/rest/poll_serializer.rb @@ -4,7 +4,7 @@ class REST::PollSerializer < ActiveModel::Serializer attributes :id, :expires_at, :expired, :multiple, :votes_count - has_many :dynamic_options, key: :options + has_many :loaded_options, key: :options attribute :voted, if: :current_user? @@ -12,20 +12,12 @@ class REST::PollSerializer < ActiveModel::Serializer object.id.to_s end - def dynamic_options - if !object.expired? && object.hide_totals? - object.unloaded_options - else - object.loaded_options - end - end - def expired object.expired? end def voted - object.votes.where(account: current_user.account).exists? + object.voted?(current_user.account) end def current_user? |