mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 10:15:13 +08:00
cac80cdc3b
This is a work in progress commit for more send to public_send conversions Also adds some comments for cases where we need to keep send
24 lines
444 B
Ruby
24 lines
444 B
Ruby
class TopListSerializer < ApplicationSerializer
|
|
|
|
attributes :can_create_topic,
|
|
:draft,
|
|
:draft_key,
|
|
:draft_sequence
|
|
|
|
def can_create_topic
|
|
scope.can_create?(Topic)
|
|
end
|
|
|
|
TopTopic.periods.each do |period|
|
|
attribute period
|
|
|
|
define_method(period) do
|
|
if resolved = object.public_send(period)
|
|
TopicListSerializer.new(resolved, scope: scope).as_json
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
end
|