Commit 2d057da1 authored by Tim Zallmann's avatar Tim Zallmann

Turned cache_privately? into cache_publicly?

Also removed unnecessary comment
parent 86cda964
...@@ -29,12 +29,12 @@ module UploadsActions ...@@ -29,12 +29,12 @@ module UploadsActions
def show def show
return render_404 unless uploader&.exists? return render_404 unless uploader&.exists?
if cache_privately? if cache_publicly?
expires_in 0.seconds, must_revalidate: true, private: true
else
# We need to reset caching from the applications controller to get rid of the no-store value # We need to reset caching from the applications controller to get rid of the no-store value
headers['Cache-Control'] = '' headers['Cache-Control'] = ''
expires_in 5.minutes, public: true, must_revalidate: false expires_in 5.minutes, public: true, must_revalidate: false
else
expires_in 0.seconds, must_revalidate: true, private: true
end end
disposition = uploader.image_or_video? ? 'inline' : 'attachment' disposition = uploader.image_or_video? ? 'inline' : 'attachment'
...@@ -120,8 +120,8 @@ module UploadsActions ...@@ -120,8 +120,8 @@ module UploadsActions
nil nil
end end
def cache_privately? def cache_publicly?
true false
end end
def model def model
......
...@@ -70,8 +70,8 @@ class UploadsController < ApplicationController ...@@ -70,8 +70,8 @@ class UploadsController < ApplicationController
end end
end end
def cache_privately? def cache_publicly?
true unless User === model || Appearance === model User === model || Appearance === model
end end
def upload_model_class def upload_model_class
......
...@@ -14,7 +14,6 @@ end ...@@ -14,7 +14,6 @@ end
shared_examples 'content publicly cached' do shared_examples 'content publicly cached' do
it 'ensures content is publicly cached' do it 'ensures content is publicly cached' do
# Fixed in newer versions of ActivePack, it will only output a single `private`.
expect(subject['Cache-Control']).to eq('max-age=300, public') expect(subject['Cache-Control']).to eq('max-age=300, public')
end end
end end
......
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