FEATURE: New site setting embed_unlisted (#9391)

If enabled, posts imported to discourse via embeddings will default to
unlisted until they receive a reply.
This commit is contained in:
Robin Ward
2020-04-13 15:17:02 -04:00
committed by GitHub
parent 7b4fdebbce
commit b6b92a562c
9 changed files with 48 additions and 13 deletions

View File

@ -41,6 +41,7 @@ describe TopicEmbed do
expect(TopicEmbed.where(topic_id: post.topic_id)).to be_present
expect(post.topic.category).to eq(embeddable_host.category)
expect(post.topic).to be_visible
end
it "Supports updating the post content" do
@ -71,6 +72,20 @@ describe TopicEmbed do
post = TopicEmbed.import(user, cased_url, title, "some random content")
expect(post.cooked).to match(/#{cased_url}/)
end
it "will make the topic unlisted if `embed_unlisted` is set until someone replies" do
SiteSetting.embed_unlisted = true
imported_post = TopicEmbed.import(user, "http://eviltrout.com/abcd", title, "some random content")
expect(imported_post.topic).not_to be_visible
pc = PostCreator.new(
Fabricate(:user),
raw: "this is a reply that will make the topic visible",
topic_id: imported_post.topic_id,
reply_to_post_number: 1
)
pc.create
expect(imported_post.topic.reload).to be_visible
end
end
context "post creation supports markdown rendering" do