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

frecent_groups_resolver.rb « users « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2fc757e31abf7179db6a1552b8bf0b312fc158a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Resolvers
  module Users
    class FrecentGroupsResolver < BaseResolver
      include Gitlab::Graphql::Authorize::AuthorizeResource

      type [Types::GroupType], null: true

      def resolve
        return unless current_user.present?

        if Feature.disabled?(:frecent_namespaces_suggestions, current_user)
          raise_resource_not_available_error!("'frecent_namespaces_suggestions' feature flag is disabled")
        end

        return unless Feature.enabled?(:frecent_namespaces_suggestions, current_user)

        ::Users::GroupVisit.frecent_groups(user_id: current_user.id)
      end
    end
  end
end