FIX: do not create topic link reflection for unlisted topics

This commit is contained in:
Arpit Jalan
2017-08-22 14:28:01 +05:30
parent 29a9e0c4d2
commit b00747fd49
2 changed files with 16 additions and 2 deletions

View File

@ -251,6 +251,21 @@ http://b.com/#{'a' * 500}
end
describe 'internal link from unlisted topic' do
it 'works' do
unlisted_topic = Fabricate(:topic, user: user, visible: false)
url = "http://#{test_uri.host}/t/topic-slug/#{topic.id}"
unlisted_topic.posts.create(user: user, raw: 'initial post')
linked_post = unlisted_topic.posts.create(user: user, raw: "Link to another topic: #{url}")
TopicLink.extract_from(linked_post)
expect(topic.topic_links.first).to eq(nil)
expect(unlisted_topic.topic_links.first).not_to eq(nil)
end
end
describe 'internal link with non-standard port' do
it 'includes the non standard port if present' do
other_topic = Fabricate(:topic, user: user)