mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Add 'groups' option to polls (#8469)
This options can be used to restrict polls to certain groups.
This commit is contained in:
@@ -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
|
||||
#
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user