Memoize IssuableFinder#projects

Since this method's returned data doesn't change between calls on the
same IssuableFinder instance we can just memoize this similar to the
"project" method.
This commit is contained in:
Yorick Peterse 2015-11-11 12:49:31 +01:00
parent c232a0f97f
commit e9cd58f5d5
1 changed files with 3 additions and 3 deletions

View File

@ -77,11 +77,11 @@ class IssuableFinder
return @projects if defined?(@projects)
if project?
project
@projects = project
elsif current_user && params[:authorized_only].presence && !current_user_related?
current_user.authorized_projects
@projects = current_user.authorized_projects
else
ProjectsFinder.new.execute(current_user)
@projects = ProjectsFinder.new.execute(current_user)
end
end