2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-01-08 15:44:27 -06:00
|
|
|
# Helps us respond with a topic list from a controller
|
|
|
|
module TopicListResponder
|
|
|
|
def respond_with_list(list)
|
|
|
|
discourse_expires_in 1.minute
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html do
|
|
|
|
@list = list
|
2023-01-09 06:10:19 -06:00
|
|
|
store_preloaded(
|
|
|
|
list.preload_key,
|
|
|
|
MultiJson.dump(TopicListSerializer.new(list, scope: guardian)),
|
|
|
|
)
|
|
|
|
render "list/list"
|
2015-01-08 15:44:27 -06:00
|
|
|
end
|
2023-01-09 06:10:19 -06:00
|
|
|
format.json { render_serialized(list, TopicListSerializer) }
|
2015-01-08 15:44:27 -06:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|