Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2d057da1
Commit
2d057da1
authored
Jan 22, 2019
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turned cache_privately? into cache_publicly?
Also removed unnecessary comment
parent
86cda964
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
app/controllers/concerns/uploads_actions.rb
app/controllers/concerns/uploads_actions.rb
+5
-5
app/controllers/uploads_controller.rb
app/controllers/uploads_controller.rb
+2
-2
spec/controllers/uploads_controller_spec.rb
spec/controllers/uploads_controller_spec.rb
+0
-1
No files found.
app/controllers/concerns/uploads_actions.rb
View file @
2d057da1
...
@@ -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_p
rivate
ly?
def
cache_p
ublic
ly?
tru
e
fals
e
end
end
def
model
def
model
...
...
app/controllers/uploads_controller.rb
View file @
2d057da1
...
@@ -70,8 +70,8 @@ class UploadsController < ApplicationController
...
@@ -70,8 +70,8 @@ class UploadsController < ApplicationController
end
end
end
end
def
cache_p
rivate
ly?
def
cache_p
ublic
ly?
true
unless
User
===
model
||
Appearance
===
model
User
===
model
||
Appearance
===
model
end
end
def
upload_model_class
def
upload_model_class
...
...
spec/controllers/uploads_controller_spec.rb
View file @
2d057da1
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment