diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-03-08 00:57:13 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-03-08 00:57:13 +0100 |
commit | 5528719bc9fd4e8dca0e5e51de183a6dd27b4d55 (patch) | |
tree | 30e615140e1afbe8d7d8986fe4743d1e4aeb7a03 /app/serializers | |
parent | 38e9c66f34d7054357a3de63834f182734d43d75 (diff) | |
parent | 3aaac4f134eb092baeb0ba5979bdb3abd702a4ee (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/activitypub/note_serializer.rb | 6 | ||||
-rw-r--r-- | app/serializers/rest/poll_serializer.rb | 12 |
2 files changed, 3 insertions, 15 deletions
diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index 3a9e388a5..553f333d8 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -122,11 +122,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer end def poll_options - if !object.poll.expired? && object.poll.hide_totals? - object.poll.unloaded_options - else - object.poll.loaded_options - end + object.poll.loaded_options end def poll_and_multiple? 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? |