gitlab-org--gitlab-foss/app/finders/boards/visits_finder.rb
Alexandru Croitor 0f6c42c5ce Move Multiple Issue Boards for Projects to Core
Refactor code to allow multiple issue boards management for projects
in CE
2019-06-26 12:28:00 +03:00

26 lines
535 B
Ruby

# 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