Skip to content

A platform for community discussion. Free, open, simple.

FIX: Make reply-ids public by fixing a typo (#16137)

Jarek Radoszbf252752e7fe
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index e0515bba1ba..0134f41197b 100644
--- a/app/controllers/posts_controller.rb
+++ b/app/controllers/posts_controller.rb
@@ -9,7 +9,7 @@ class PostsController < ApplicationController
:by_date,
:short_link,
:reply_history,
- :replyIids,
+ :reply_ids,
:revisions,
:latest_revision,
:expand_embed,
diff --git a/spec/requests/posts_controller_spec.rb b/spec/requests/posts_controller_spec.rb
index d22b1907b6c..c0a7ff4d604 100644
--- a/spec/requests/posts_controller_spec.rb
+++ b/spec/requests/posts_controller_spec.rb
@@ -170,6 +170,28 @@ describe PostsController do
end
end
+ describe '#reply_ids' do
+ include_examples 'finding and showing post' do
+ let(:url) { "/posts/#{post.id}/reply-ids.json" }
+ end
+
+ it "returns ids of post's replies" do
+ post = Fabricate(:post)
+ reply1 = Fabricate(:post, topic: post.topic, reply_to_post_number: post.post_number)
+ reply2 = Fabricate(:post, topic: post.topic, reply_to_post_number: post.post_number)
+ PostReply.create(post_id: post.id, reply_post_id: reply1.id)
+ PostReply.create(post_id: post.id, reply_post_id: reply2.id)
+
+ get "/posts/#{post.id}/reply-ids.json"
+
+ expect(response.status).to eq(200)
+ expect(response.parsed_body).to eq([
+ { "id" => reply1.id, "level" => 1 },
+ { "id" => reply2.id, "level" => 1 },
+ ])
+ end
+ end
+
describe '#replies' do
include_examples 'finding and showing post' do
let(:url) { "/posts/#{post.id}/replies.json" }