mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Show the entire history of replies above a post when you expend "in reply to"
This commit is contained in:
@@ -13,7 +13,6 @@ describe PostsController do
|
||||
end
|
||||
|
||||
describe 'show' do
|
||||
|
||||
let(:user) { log_in }
|
||||
let(:post) { Fabricate(:post, user: user) }
|
||||
|
||||
@@ -52,9 +51,26 @@ describe PostsController do
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'reply_history' do
|
||||
let(:user) { log_in }
|
||||
let(:post) { Fabricate(:post, user: user) }
|
||||
|
||||
it 'ensures the user can see the post' do
|
||||
Guardian.any_instance.expects(:can_see?).with(post).returns(false)
|
||||
xhr :get, :reply_history, id: post.id
|
||||
response.should be_forbidden
|
||||
end
|
||||
|
||||
it 'suceeds' do
|
||||
Post.any_instance.expects(:reply_history)
|
||||
xhr :get, :reply_history, id: post.id
|
||||
response.should be_success
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe 'versions' do
|
||||
|
||||
shared_examples 'posts_controller versions examples' do
|
||||
|
||||
@@ -711,7 +711,6 @@ describe Post do
|
||||
|
||||
|
||||
context 'sort_order' do
|
||||
|
||||
context 'regular topic' do
|
||||
|
||||
let!(:p1) { Fabricate(:post, post_args) }
|
||||
@@ -722,6 +721,20 @@ describe Post do
|
||||
Post.regular_order.should == [p1, p2, p3]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "reply_history" do
|
||||
|
||||
let!(:p1) { Fabricate(:post, post_args) }
|
||||
let!(:p2) { Fabricate(:post, post_args.merge(reply_to_post_number: p1.post_number)) }
|
||||
let!(:p3) { Fabricate(:post, post_args) }
|
||||
let!(:p4) { Fabricate(:post, post_args.merge(reply_to_post_number: p2.post_number)) }
|
||||
|
||||
it "returns the posts in reply to this post" do
|
||||
p4.reply_history.should == [p1, p2]
|
||||
p3.reply_history.should be_blank
|
||||
p2.reply_history.should == [p1]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user