Merge pull request #2938 from riking/include_raw

Add ?include_raw parameter to topic views
This commit is contained in:
Sam 2014-11-04 14:26:35 +11:00
commit 8432acf0af
2 changed files with 2 additions and 1 deletions

View file

@ -441,7 +441,7 @@ class TopicsController < ApplicationController
end end
def perform_show_response def perform_show_response
topic_view_serializer = TopicViewSerializer.new(@topic_view, scope: guardian, root: false) topic_view_serializer = TopicViewSerializer.new(@topic_view, scope: guardian, root: false, include_raw: !!params[:include_raw])
respond_to do |format| respond_to do |format|
format.html do format.html do

View file

@ -21,6 +21,7 @@ module PostStreamSerializerMixin
object.posts.each_with_index do |p, idx| object.posts.each_with_index do |p, idx|
highest_number_in_posts = p.post_number if p.post_number > highest_number_in_posts highest_number_in_posts = p.post_number if p.post_number > highest_number_in_posts
ps = PostSerializer.new(p, scope: scope, root: false) ps = PostSerializer.new(p, scope: scope, root: false)
ps.add_raw = true if @options[:include_raw]
ps.topic_view = object ps.topic_view = object
p.topic = object.topic p.topic = object.topic