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

project_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: ae8fab3ffca09345a9652bcbe645b556bc1d63e5 (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 ProjectPrivateService < ::Todos::Destroy::BaseService
      extend ::Gitlab::Utils::Override

      attr_reader :project

      def initialize(project_id)
        @project = Project.find_by(id: project_id)
      end

      private

      override :todos
      def todos
        Todo.where(project_id: project.id)
      end

      override :project_ids
      def project_ids
        project.id
      end

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