diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-01-26 14:28:08 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-06 13:35:35 +0000 |
commit | dc229c076cdc0ef6e7f3f74f6e462c22880ff08c (patch) | |
tree | ec2c979bf3dcb0af71661a7903afd02b2e6f6114 /lib/api/helpers/internal_helpers.rb | |
parent | e42a548f1dac02577d0c1731fef508dab68c45a5 (diff) | |
download | gitlab-ce-dc229c076cdc0ef6e7f3f74f6e462c22880ff08c.tar.gz |
Abstracts ProjectMoved and ProjectCreated into a BaseProject
Diffstat (limited to 'lib/api/helpers/internal_helpers.rb')
-rw-r--r-- | lib/api/helpers/internal_helpers.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb index 2340e962918..bff245fe9a2 100644 --- a/lib/api/helpers/internal_helpers.rb +++ b/lib/api/helpers/internal_helpers.rb @@ -1,6 +1,8 @@ module API module Helpers module InternalHelpers + include Gitlab::Utils::StrongMemoize + attr_reader :redirected_path def wiki? @@ -65,13 +67,15 @@ module API end def project_namespace - @project_namespace ||= project&.namespace || Namespace.find_by_full_path(project_match[:namespace_path]) + strong_memoize(:project_namespace) do + project&.namespace || Namespace.find_by_full_path(project_match[:namespace_path]) + end end private def project_match - @project_match ||= params[:project].match(Gitlab::PathRegex.full_project_git_path_regex) + @project_match ||= params[:project].match(Gitlab::PathRegex.full_project_git_path_regex) || {} end # rubocop:disable Gitlab/ModuleWithInstanceVariables |