debian-mirror-gitlab/app/graphql/resolvers/recent_boards_resolver.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
422 B
Ruby
Raw Normal View History

2022-04-04 11:22:00 +05:30
# frozen_string_literal: true
module Resolvers
class RecentBoardsResolver < BaseResolver
type Types::BoardType, null: true
def resolve
parent = object.respond_to?(:sync) ? object.sync : object
return Board.none unless parent
recent_visits =
::Boards::VisitsFinder.new(parent, current_user).latest(Board::RECENT_BOARDS_SIZE)
recent_visits&.map(&:board) || []
end
end
end