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

25 lines
601 B
Ruby
Raw Normal View History

module Gitlab
module ChatCommands
2016-11-17 09:30:04 -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 self.allowed?(project, user)
can?(user, :create_issue, project)
end
def execute(match)
title = match[:title]
description = match[:description]
2016-11-17 09:30:04 -05:00
Issues::CreateService.new(project, current_user, title: title, description: description).execute
end
end
end
end