From 6a946712b388887b575345a640f78dda15fc11c2 Mon Sep 17 00:00:00 2001 From: riking Date: Sat, 1 Nov 2014 14:30:08 -0700 Subject: [PATCH] Add ?include_raw parameter to topic views --- app/controllers/topics_controller.rb | 2 +- app/serializers/post_stream_serializer_mixin.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index ade19cbd525..e4e31cb55be 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -441,7 +441,7 @@ class TopicsController < ApplicationController end 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| format.html do diff --git a/app/serializers/post_stream_serializer_mixin.rb b/app/serializers/post_stream_serializer_mixin.rb index f87edaa2843..e5edb78978e 100644 --- a/app/serializers/post_stream_serializer_mixin.rb +++ b/app/serializers/post_stream_serializer_mixin.rb @@ -21,6 +21,7 @@ module PostStreamSerializerMixin object.posts.each_with_index do |p, idx| highest_number_in_posts = p.post_number if p.post_number > highest_number_in_posts ps = PostSerializer.new(p, scope: scope, root: false) + ps.add_raw = true if @options[:include_raw] ps.topic_view = object p.topic = object.topic