summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-04-24 12:38:09 +0200
committerBob Van Landuyt <bob@gitlab.com>2017-05-01 11:14:24 +0200
commit12735eefcd7876435cd05f35a9f26bfe2836e09f (patch)
treea433db37dd74431960817038f86d9ffa8bef9c66 /lib
parentea8e86dac856fdf6545e020df346533231379b93 (diff)
downloadgitlab-ce-12735eefcd7876435cd05f35a9f26bfe2836e09f.tar.gz
Minor style adjustments
Diffstat (limited to 'lib')
-rw-r--r--lib/constraints/project_url_constrainer.rb4
-rw-r--r--lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb7
-rw-r--r--lib/gitlab/etag_caching/router.rb2
3 files changed, 6 insertions, 7 deletions
diff --git a/lib/constraints/project_url_constrainer.rb b/lib/constraints/project_url_constrainer.rb
index 064e1bd78e3..d0ce2caffff 100644
--- a/lib/constraints/project_url_constrainer.rb
+++ b/lib/constraints/project_url_constrainer.rb
@@ -4,9 +4,7 @@ class ProjectUrlConstrainer
project_path = request.params[:project_id] || request.params[:id]
full_path = namespace_path + '/' + project_path
- unless DynamicPathValidator.valid?(full_path)
- return false
- end
+ return false unless DynamicPathValidator.valid?(full_path)
Project.find_by_full_path(full_path).present?
end
diff --git a/lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb b/lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb
index 4937dfe2d31..4143e0edc62 100644
--- a/lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb
+++ b/lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb
@@ -11,13 +11,14 @@ module Gitlab
end
def namespaces_for_paths(type:)
- namespaces = if type == :wildcard
+ namespaces = case type
+ when :wildcard
MigrationClasses::Namespace.where.not(parent_id: nil)
- elsif type == :top_level
+ when :top_level
MigrationClasses::Namespace.where(parent_id: nil)
end
with_paths = MigrationClasses::Route.arel_table[:path].
- matches_any(path_patterns)
+ matches_any(path_patterns)
namespaces.joins(:route).where(with_paths)
end
diff --git a/lib/gitlab/etag_caching/router.rb b/lib/gitlab/etag_caching/router.rb
index c7da8b07a56..aac210f19e8 100644
--- a/lib/gitlab/etag_caching/router.rb
+++ b/lib/gitlab/etag_caching/router.rb
@@ -8,7 +8,7 @@ module Gitlab
# regex itself)
# - Ending in `noteable/issue/<id>/notes` for the `issue_notes` route
# - Ending in `issues/id`/rendered_title` for the `issue_title` route
- USED_IN_ROUTES = %w[noteable issue notes issues renderred_title
+ USED_IN_ROUTES = %w[noteable issue notes issues rendered_title
commit pipelines merge_requests new].freeze
RESERVED_WORDS = DynamicPathValidator::WILDCARD_ROUTES - USED_IN_ROUTES
RESERVED_WORDS_REGEX = Regexp.union(*RESERVED_WORDS)