Apply embed unlisted setting consistently (#24294)

Applies the embed_unlisted site setting consistently across topic embeds, including those created via the WP Discourse plugin. Relatedly, adds a embed exception to can_create_unlisted_topic? check. Users creating embedded topics are not always staff.
This commit is contained in:
Angus McLeod
2023-12-12 15:35:26 +01:00
committed by GitHub
parent 7d0562f10e
commit 95c61b88dc
7 changed files with 57 additions and 20 deletions

View File

@ -641,6 +641,18 @@ RSpec.describe TopicCreator do
it "is valid for an admin" do
expect(TopicCreator.new(admin, Guardian.new(admin), unlisted_attrs).valid?).to eq(true)
end
context "when embedded" do
let(:embedded_unlisted_attrs) do
unlisted_attrs.merge(embed_url: "http://eviltrout.com/stupid-url")
end
it "is valid for a non-staff user" do
expect(TopicCreator.new(user, Guardian.new(user), embedded_unlisted_attrs).valid?).to eq(
true,
)
end
end
end
end
end