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

issue_show.rb « slash_commands « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5f5fa32ff20260b31fff6301b4b5d678191b1888 (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
# frozen_string_literal: true

module Gitlab
  module SlashCommands
    class IssueShow < IssueCommand
      def self.match(text)
        /\Aissue\s+show\s+#{Issue.reference_prefix}?(?<iid>\d+)/.match(text)
      end

      def self.help_message
        "issue show <id>"
      end

      def execute(match)
        issue = find_by_iid(match[:iid])

        if issue
          Gitlab::SlashCommands::Presenters::IssueShow.new(issue).present
        else
          Gitlab::SlashCommands::Presenters::Access.new.not_found
        end
      end
    end
  end
end