summaryrefslogtreecommitdiff
path: root/lib/api/helpers
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-02-02 15:27:30 +0000
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-02-06 16:52:29 +0000
commit1e56b3f476f9779ec747534e94156a6b8076209c (patch)
treee9374a520232a2d96ef55bf3089dd5350db0a900 /lib/api/helpers
parent839829a7786dd163eccb470bf251211bfb90bd72 (diff)
downloadgitlab-ce-1e56b3f476f9779ec747534e94156a6b8076209c.tar.gz
Moves project creationg to git access check for git push
Diffstat (limited to 'lib/api/helpers')
-rw-r--r--lib/api/helpers/internal_helpers.rb20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb
index bff245fe9a2..cd59da6fc70 100644
--- a/lib/api/helpers/internal_helpers.rb
+++ b/lib/api/helpers/internal_helpers.rb
@@ -1,8 +1,6 @@
module API
module Helpers
module InternalHelpers
- include Gitlab::Utils::StrongMemoize
-
attr_reader :redirected_path
def wiki?
@@ -49,10 +47,6 @@ module API
::Users::ActivityService.new(actor, 'Git SSH').execute if commands.include?(params[:action])
end
- def receive_pack?
- params[:action] == 'git-receive-pack'
- end
-
def merge_request_urls
::MergeRequests::GetUrlsService.new(project).execute(params[:changes])
end
@@ -66,16 +60,18 @@ module API
false
end
- def project_namespace
- strong_memoize(:project_namespace) do
- project&.namespace || Namespace.find_by_full_path(project_match[:namespace_path])
- end
+ def project_path
+ project&.path || project_path_match[:project_path]
+ end
+
+ def namespace_path
+ project&.namespace&.full_path || project_path_match[:namespace_path]
end
private
- def project_match
- @project_match ||= params[:project].match(Gitlab::PathRegex.full_project_git_path_regex) || {}
+ def project_path_match
+ @project_path_match ||= params[:project].match(Gitlab::PathRegex.full_project_git_path_regex) || {}
end
# rubocop:disable Gitlab/ModuleWithInstanceVariables