diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-02-22 18:10:32 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-02-23 18:31:57 +0300 |
commit | 5c7f9d69e3db27921acf6d8259245f2b4babcc2b (patch) | |
tree | b90334ce234ddd3921e0f1780cf3bb0848adff7b /app/helpers | |
parent | 02494f7ce86fbf1276b384f45f58558c427eff63 (diff) |
Fix code for cops
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 11 | ||||
-rw-r--r-- | app/helpers/blob_helper.rb | 21 | ||||
-rw-r--r-- | app/helpers/submodule_helper.rb | 2 |
3 files changed, 18 insertions, 16 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ed4be180f04..70419eb4bde 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -69,11 +69,12 @@ module ApplicationHelper end def avatar_icon(user_or_email = nil, size = nil, scale = 2) - user = if user_or_email.is_a?(User) - user_or_email - else - User.find_by_any_email(user_or_email.try(:downcase)) - end + user = + if user_or_email.is_a?(User) + user_or_email + else + User.find_by_any_email(user_or_email.try(:downcase)) + end if user user.avatar_url(size) || default_avatar diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 6cba11f1b63..7f32c1b5300 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -153,16 +153,17 @@ module BlobHelper # Because we are opionated we set the cache headers ourselves. response.cache_control[:public] = @project.public? - response.cache_control[:max_age] = if @ref && @commit && @ref == @commit.id - # This is a link to a commit by its commit SHA. That means that the blob - # is immutable. The only reason to invalidate the cache is if the commit - # was deleted or if the user lost access to the repository. - Blob::CACHE_TIME_IMMUTABLE - else - # A branch or tag points at this blob. That means that the expected blob - # value may change over time. - Blob::CACHE_TIME - end + response.cache_control[:max_age] = + if @ref && @commit && @ref == @commit.id + # This is a link to a commit by its commit SHA. That means that the blob + # is immutable. The only reason to invalidate the cache is if the commit + # was deleted or if the user lost access to the repository. + Blob::CACHE_TIME_IMMUTABLE + else + # A branch or tag points at this blob. That means that the expected blob + # value may change over time. + Blob::CACHE_TIME + end response.etag = @blob.id !stale diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index 97d8cde4b3d..fb95f2b565e 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -38,7 +38,7 @@ module SubmoduleHelper def self_url?(url, namespace, project) return true if url == [Gitlab.config.gitlab.url, '/', namespace, '/', - project, '.git'].join('') + project, '.git'].join('') url == gitlab_shell.url_to_repo([namespace, '/', project].join('')) end |