summaryrefslogtreecommitdiff
path: root/app/finders/issuable_finder/params.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/finders/issuable_finder/params.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/finders/issuable_finder/params.rb')
-rw-r--r--app/finders/issuable_finder/params.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/finders/issuable_finder/params.rb b/app/finders/issuable_finder/params.rb
index adf9f1ca9d8..5b48d0817e3 100644
--- a/app/finders/issuable_finder/params.rb
+++ b/app/finders/issuable_finder/params.rb
@@ -105,7 +105,7 @@ class IssuableFinder
end
def project?
- params[:project_id].present?
+ project_id.present?
end
def group
@@ -132,15 +132,19 @@ class IssuableFinder
def project
strong_memoize(:project) do
- next nil unless params[:project_id].present?
+ next nil unless project?
- project = Project.find(params[:project_id])
+ project = project_id.is_a?(Project) ? project_id : Project.find(project_id)
project = nil unless Ability.allowed?(current_user, :"read_#{klass.to_ability_name}", project)
project
end
end
+ def project_id
+ params[:project_id]
+ end
+
def projects
strong_memoize(:projects) do
next [project] if project?