Commit 5ce21aa2 authored by Alex Kalderimis's avatar Alex Kalderimis

Minor project_id improvements to IssuableFinder::Params

parent 8fc733e6
...@@ -105,7 +105,7 @@ class IssuableFinder ...@@ -105,7 +105,7 @@ class IssuableFinder
end end
def project? def project?
params[:project_id].present? project_id.present?
end end
def group def group
...@@ -132,15 +132,19 @@ class IssuableFinder ...@@ -132,15 +132,19 @@ class IssuableFinder
def project def project
strong_memoize(:project) do 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 = nil unless Ability.allowed?(current_user, :"read_#{klass.to_ability_name}", project)
project project
end end
end end
def project_id
params[:project_id]
end
def projects def projects
strong_memoize(:projects) do strong_memoize(:projects) do
next [project] if project? next [project] if project?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment