diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-02 15:27:30 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-05 16:12:38 +0000 |
commit | 91c12da9033805d54c32f6081103d0d139dd22b7 (patch) | |
tree | d280a30efaea0c071e1a85225242283c951ea926 /lib/api/helpers | |
parent | fb8fed954cf4b97f76316f8b160069f1fcf03d92 (diff) | |
download | gitlab-ce-26388-refactor-proposal.tar.gz |
Adds proposal for 26388 refactor26388-refactor-proposal
Diffstat (limited to 'lib/api/helpers')
-rw-r--r-- | lib/api/helpers/internal_helpers.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb index bff245fe9a2..fdb441375eb 100644 --- a/lib/api/helpers/internal_helpers.rb +++ b/lib/api/helpers/internal_helpers.rb @@ -66,16 +66,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&.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 |