Commit 07451246 authored by Aleksei Lipniagov's avatar Aleksei Lipniagov Committed by Kamil Trzciński

Allow image resizing if `current_user=nil`

parent 1e3eb8aa
...@@ -55,8 +55,7 @@ module SendFileUpload ...@@ -55,8 +55,7 @@ module SendFileUpload
def image_scaling_request?(file_upload) def image_scaling_request?(file_upload)
avatar_safe_for_scaling?(file_upload) && avatar_safe_for_scaling?(file_upload) &&
scaling_allowed_by_feature_flags?(file_upload) && scaling_allowed_by_feature_flags?(file_upload) &&
valid_image_scaling_width? && valid_image_scaling_width?
current_user
end end
def avatar_safe_for_scaling?(file_upload) def avatar_safe_for_scaling?(file_upload)
......
...@@ -79,6 +79,23 @@ RSpec.describe SendFileUpload do ...@@ -79,6 +79,23 @@ RSpec.describe SendFileUpload do
it_behaves_like 'handles image resize requests allowed by FFs' it_behaves_like 'handles image resize requests allowed by FFs'
end end
context 'when boths FFs are enabled globally' do
before do
stub_feature_flags(dynamic_image_resizing_requester: true)
stub_feature_flags(dynamic_image_resizing_owner: true)
end
it_behaves_like 'handles image resize requests allowed by FFs'
context 'when current_user is nil' do
before do
allow(controller).to receive(:current_user).and_return(nil)
end
it_behaves_like 'handles image resize requests allowed by FFs'
end
end
context 'when only FF based on content requester is enabled for current user' do context 'when only FF based on content requester is enabled for current user' do
before do before do
stub_feature_flags(dynamic_image_resizing_requester: image_requester) stub_feature_flags(dynamic_image_resizing_requester: image_requester)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment