summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorAlexandru Croitor <acroitor@gitlab.com>2019-06-17 15:58:48 +0300
committerAlexandru Croitor <acroitor@gitlab.com>2019-06-26 12:28:00 +0300
commit0f6c42c5ce165dadf1976ae15a043b87ca533618 (patch)
tree9220ed5a8eb628ca3c5170a0d5f9400870538797 /app/finders
parent2b9ddc2f99bc0a49967c9ccc5b79ccc53e7559b4 (diff)
downloadgitlab-ce-0f6c42c5ce165dadf1976ae15a043b87ca533618.tar.gz
Move Multiple Issue Boards for Projects to Core53811-issue-boards-to-core-projects-backend-ce
Refactor code to allow multiple issue boards management for projects in CE
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/boards/visits_finder.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/finders/boards/visits_finder.rb b/app/finders/boards/visits_finder.rb
new file mode 100644
index 00000000000..d17a27f72dc
--- /dev/null
+++ b/app/finders/boards/visits_finder.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+module Boards
+ class VisitsFinder
+ attr_accessor :params, :current_user, :parent
+
+ def initialize(parent, current_user)
+ @current_user = current_user
+ @parent = parent
+ end
+
+ def execute(count = nil)
+ return unless current_user
+
+ recent_visit_model.latest(current_user, parent, count: count)
+ end
+
+ alias_method :latest, :execute
+
+ private
+
+ def recent_visit_model
+ parent.is_a?(Group) ? BoardGroupRecentVisit : BoardProjectRecentVisit
+ end
+ end
+end