summaryrefslogtreecommitdiff
path: root/app/services/mattermost/commands/issue_create_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/mattermost/commands/issue_create_service.rb')
-rw-r--r--app/services/mattermost/commands/issue_create_service.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/services/mattermost/commands/issue_create_service.rb b/app/services/mattermost/commands/issue_create_service.rb
index e52dad6f532..db3f868fc09 100644
--- a/app/services/mattermost/commands/issue_create_service.rb
+++ b/app/services/mattermost/commands/issue_create_service.rb
@@ -1,12 +1,20 @@
module Mattermost
module Commands
- class IssueShowService < Mattermost::Commands::BaseService
+ class IssueCreateService < IssueService
def execute
- return Mattermost::Messages::Issues.not_available unless available?
+ title, description = parse_command
- issue = find_by_iid(iid)
+ present Issues::CreateService.new(project, current_user, title: title, description: description).execute
+ end
+
+ private
+
+ def parse_command
+ match = params[:text].match(/\Aissue create (?<title>.*)\n*/)
+ title = match[:title]
+ description = match.post_match
- present issue
+ [title, description]
end
end
end