Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-08-05 16:29:20 +0300
committerPaco Guzman <pacoguzmanp@gmail.com>2016-08-17 08:33:51 +0300
commit03386633a42bd56b0b0b31b70eebaaaa33e1494e (patch)
tree24913e88546ebfce79f66a84a28e0a2f536776c0 /app/finders
parent1b338d59f641ce629cbecb839b64c9fd65561276 (diff)
Move to project dropdown with infinite scroll for better performance
Use just SQL to check is a user can admin_issue on a project Tradeoff - we duplicate how we check admin_issue in a SQL relation in the Ability class
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/move_to_project_finder.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/finders/move_to_project_finder.rb b/app/finders/move_to_project_finder.rb
new file mode 100644
index 00000000000..3334b8556df
--- /dev/null
+++ b/app/finders/move_to_project_finder.rb
@@ -0,0 +1,14 @@
+class MoveToProjectFinder
+ def initialize(user)
+ @user = user
+ end
+
+ def execute(from_project, search: nil, offset_id: nil)
+ projects = @user.projects_where_can_admin_issues
+ projects = projects.search(search) if search.present?
+ projects = projects.excluding_project(from_project)
+
+ # to ask for Project#name_with_namespace
+ projects.includes(namespace: :owner)
+ end
+end