A platform for community discussion. Free, open, simple.
FIX: Update post's raw from server response (#13438)
Bianca Nenciu09b55fd33842
diff --git a/app/serializers/new_post_result_serializer.rb b/app/serializers/new_post_result_serializer.rbindex 9232062711e..e15af2fad14 100644--- a/app/serializers/new_post_result_serializer.rb+++ b/app/serializers/new_post_result_serializer.rb@@ -13,7 +13,7 @@ class NewPostResultSerializer < ApplicationSerializerhas_one :pending_post, serializer: TopicPendingPostSerializer, root: false, embed: :objectsdef post- post_serializer = PostSerializer.new(object.post, scope: scope, root: false)+ post_serializer = PostSerializer.new(object.post, scope: scope, root: false, add_raw: true)post_serializer.draft_sequence = DraftSequence.current(scope.user, object.post.topic.draft_key)post_serializer.as_jsonenddiff --git a/spec/requests/api/schemas/json/topic_create_response.json b/spec/requests/api/schemas/json/topic_create_response.jsonindex d80c4c29013..d14e56b85c3 100644--- a/spec/requests/api/schemas/json/topic_create_response.json+++ b/spec/requests/api/schemas/json/topic_create_response.json@@ -19,6 +19,9 @@"created_at": {"type": "string"},+ "raw": {+ "type": "string"+ },"cooked": {"type": "string"},diff --git a/spec/requests/posts_controller_spec.rb b/spec/requests/posts_controller_spec.rbindex a149ed697fc..5c0c00d7044 100644--- a/spec/requests/posts_controller_spec.rb+++ b/spec/requests/posts_controller_spec.rb@@ -989,7 +989,7 @@ describe PostsController doit "returns the nested post with a param" dopost "/posts.json", params: {- raw: 'this is the test content',+ raw: 'this is the test content ',title: 'this is the test title for the topic',nested_post: true}@@ -997,6 +997,7 @@ describe PostsController doexpect(response.status).to eq(200)parsed = response.parsed_bodyexpect(parsed['post']).to be_present+ expect(parsed['post']['raw']).to eq('this is the test content')expect(parsed['post']['cooked']).to be_presentend