2016-11-16 12:28:38 -05:00
|
|
|
module Gitlab
|
|
|
|
module ChatCommands
|
|
|
|
class IssueCreate < BaseCommand
|
|
|
|
def self.match(text)
|
|
|
|
/\Aissue\s+create\s+(?<title>[^\n]*)\n*(?<description>.*)\z/.match(text)
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute(match)
|
2016-11-17 06:06:45 -05:00
|
|
|
present nil unless can?(current_user, :create_issue, project)
|
|
|
|
|
2016-11-16 12:28:38 -05:00
|
|
|
title = match[:title]
|
|
|
|
description = match[:description]
|
|
|
|
|
|
|
|
present Issues::CreateService.new(project, current_user, title: title, description: description).execute
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|