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

gitlab_app.rb « mixins « slack « lib « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 66b456ef8246d3ae9035b5b5d416fa640720dfdf (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true

module Slack
  module Mixins
    module GitlabApp
      # @param [QA::Resource::Project] project
      # @param [String] channel
      # @param [String] title
      # @param [String] description
      def create_issue(project, channel:, title:, description:)
        lines = [
          "/staging-gitlab #{project.path_with_namespace} issue new #{title}",
          description
        ]

        send_message_to_channel(lines, channel: channel)
      end

      # @param [QA::Resource::Project] project
      # @param [QA::Resource::Project] target
      # @param [String] id
      # @param [String] channel
      def move_issue(project, target, id:, channel:)
        line = "/staging-gitlab #{project.path_with_namespace} issue move #{id} to #{target.path_with_namespace}"
        send_message_to_channel([line], channel: channel)
      end

      # @param [QA::Resource::Project] project
      # @param [String] id
      # @param [String] channel
      def show_issue(project, id:, channel:)
        send_message_to_channel(["/staging-gitlab #{project.path_with_namespace} issue show #{id}"], channel: channel)
      end

      # @param [QA::Resource::Project] project
      # @param [String] id
      # @param [String] channel
      def close_issue(project, id:, channel:)
        send_message_to_channel(["/staging-gitlab #{project.path_with_namespace} issue close #{id}"], channel: channel)
      end

      # @param [QA::Resource::Project] project
      # @param [String] channel
      # @param [String] id
      # @param [String] comment
      def comment_on_issue(project, channel:, id:, comment:)
        command = "/staging-gitlab #{project.path_with_namespace} issue comment #{id}"
        send_message_to_channel([command, comment], channel: channel)
      end
    end
  end
end