gitlab-org--gitlab-foss/lib/gitlab/chat_commands/issue_create.rb

23 lines
588 B
Ruby
Raw Normal View History

module Gitlab
module ChatCommands
2016-11-17 06:57:27 -05:00
class IssueCreate < IssueCommand
def self.match(text)
/\Aissue\s+create\s+(?<title>[^\n]*)\n*(?<description>.*)\z/.match(text)
end
2016-11-17 06:57:27 -05:00
def self.help_message
'issue create <title>\n<description>'
end
def execute(match)
present nil unless can?(current_user, :create_issue, project)
title = match[:title]
description = match[:description]
present Issues::CreateService.new(project, current_user, title: title, description: description).execute
end
end
end
end