mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 11:54:41 +08:00
FIX: Provide better API for registering custom upload public types (#10697)
With secure media and the UploadSecurity class, we need a nice way for plugins to register custom upload types that should be considered public and never secure.
This commit is contained in:
@ -64,6 +64,18 @@ RSpec.describe UploadSecurity do
|
||||
expect(subject.should_be_secure?).to eq(false)
|
||||
end
|
||||
end
|
||||
describe "for a custom public type" do
|
||||
let(:type) { 'my_custom_type' }
|
||||
|
||||
it "returns true if the custom type has not been added" do
|
||||
expect(subject.should_be_secure?).to eq(true)
|
||||
end
|
||||
|
||||
it "returns false if the custom type has been added" do
|
||||
UploadSecurity.register_custom_public_type(type)
|
||||
expect(subject.should_be_secure?).to eq(false)
|
||||
end
|
||||
end
|
||||
describe "for_theme" do
|
||||
before do
|
||||
upload.stubs(:for_theme).returns(true)
|
||||
|
Reference in New Issue
Block a user