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
9fccefcb
Commit
9fccefcb
authored
Oct 10, 2019
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduced the cache settings setup
parent
b793f0fa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
25 deletions
+15
-25
app/controllers/concerns/uploads_actions.rb
app/controllers/concerns/uploads_actions.rb
+8
-15
app/controllers/uploads_controller.rb
app/controllers/uploads_controller.rb
+7
-10
No files found.
app/controllers/concerns/uploads_actions.rb
View file @
9fccefcb
...
...
@@ -32,15 +32,12 @@ module UploadsActions
# We need to reset caching from the applications controller to get rid of the no-store value
headers
[
'Cache-Control'
]
=
''
headers
[
'Pragma'
]
=
''
if
cache_publicly?
# Caching for user avatars
expires_in
5
.
minutes
,
public:
true
,
must_revalidate:
false
elsif
avatar?
# Caching for Project + Group Avatars
expires_in
5
.
minutes
,
private:
true
,
must_revalidate:
true
else
expires_in
6
.
months
,
private:
true
,
must_revalidate:
true
end
ttl
,
directives
=
*
cache_settings
ttl
||=
6
.
months
directives
||=
{
private:
true
,
must_revalidate:
true
}
expires_in
ttl
,
directives
disposition
=
uploader
.
embeddable?
?
'inline'
:
'attachment'
...
...
@@ -125,12 +122,8 @@ module UploadsActions
nil
end
def
cache_publicly?
false
end
def
avatar?
false
def
cache_settings
[]
end
def
model
...
...
app/controllers/uploads_controller.rb
View file @
9fccefcb
...
...
@@ -81,16 +81,13 @@ class UploadsController < ApplicationController
end
end
def
cache_
publicly?
User
===
model
||
Appearance
===
model
end
def
avatar?
User
===
model
||
Project
===
model
||
Group
===
model
def
cache_
settings
case
model
when
User
,
Appearance
[
5
.
minutes
,
{
public:
true
,
must_revalidate:
false
}]
when
Project
,
Group
[
5
.
minutes
,
{
private:
true
,
must_revalidate:
true
}]
end
def
note_upload?
Note
===
model
end
def
secret?
...
...
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