mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 01:15:26 +08:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user