diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/projects.rb | 11 | ||||
-rw-r--r-- | lib/gitlab/search_results.rb | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 5e9e14ad00a..13f81e9506f 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -22,10 +22,10 @@ module API # Example Request: # GET /projects get do - @projects = current_user.authorized_projects - @projects = filter_projects(@projects) - @projects = paginate @projects - present @projects, with: Entities::ProjectWithAccess, user: current_user + projects = ProjectsFinder.execute(current_user, scope: :authorized) + projects = filter_projects(projects) + projects = paginate(projects) + present projects, with: Entities::ProjectWithAccess, user: current_user end # Get an owned projects list for authenticated user @@ -43,6 +43,7 @@ module API # # Example Request: # GET /projects/starred + # TODO ZJ -- Use the ProjectsFinder here get '/starred' do @projects = current_user.viewable_starred_projects @projects = filter_projects(@projects) @@ -56,7 +57,7 @@ module API # GET /projects/all get '/all' do authenticated_as_admin! - @projects = Project.without_pending_delete + @projects = ProjectsFinder.execute(current_user, scope: :all) @projects = filter_projects(@projects) @projects = paginate @projects present @projects, with: Entities::ProjectWithAccess, user: current_user diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb index 31a7536b431..78ac2e91696 100644 --- a/lib/gitlab/search_results.rb +++ b/lib/gitlab/search_results.rb @@ -8,7 +8,7 @@ module Gitlab def initialize(current_user, limit_projects, query) @current_user = current_user - @limit_projects = limit_projects || Project.without_pending_delete + @limit_projects = limit_projects || ProjectFinder.execute(current_user, scope: :authorized) @query = Shellwords.shellescape(query) if query.present? end |