FEATURE: Add 'groups' option to polls (#8469)

This options can be used to restrict polls to certain groups.
This commit is contained in:
Bianca Nenciu
2020-01-28 14:30:04 +02:00
committed by GitHub
parent a9d0d55817
commit 07222af7ab
12 changed files with 118 additions and 21 deletions

View File

@@ -78,6 +78,7 @@ end
# created_at :datetime not null
# updated_at :datetime not null
# chart_type :integer default("bar"), not null
# groups :string
#
# Indexes
#

View File

@@ -13,7 +13,8 @@ class PollSerializer < ApplicationSerializer
:voters,
:close,
:preloaded_voters,
:chart_type
:chart_type,
:groups
def public
true
@@ -35,6 +36,10 @@ class PollSerializer < ApplicationSerializer
object.step.present? && object.number?
end
def include_groups?
groups.present?
end
def options
object.poll_options.map { |o| PollOptionSerializer.new(o, root: false).as_json }
end