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

group_private_service.rb « destroy « todos « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f67f1d405977227dc1b7ac7328a057416fc5af2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

module Todos
  module Destroy
    class GroupPrivateService < ::Todos::Destroy::BaseService
      extend ::Gitlab::Utils::Override

      attr_reader :group

      def initialize(group_id)
        @group = Group.find_by(id: group_id)
      end

      private

      override :todos
      def todos
        Todo.where(group_id: group.id)
      end

      override :authorized_users
      def authorized_users
        group.direct_and_indirect_users.select(:id)
      end

      override :todos_to_remove?
      def todos_to_remove?
        group&.private?
      end
    end
  end
end