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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/slash_commands')
-rw-r--r--lib/gitlab/slash_commands/base_command.rb4
-rw-r--r--lib/gitlab/slash_commands/presenters/issue_new.rb14
-rw-r--r--lib/gitlab/slash_commands/run.rb2
3 files changed, 12 insertions, 8 deletions
diff --git a/lib/gitlab/slash_commands/base_command.rb b/lib/gitlab/slash_commands/base_command.rb
index fcc120112f2..e184afa0032 100644
--- a/lib/gitlab/slash_commands/base_command.rb
+++ b/lib/gitlab/slash_commands/base_command.rb
@@ -36,7 +36,9 @@ module Gitlab
attr_accessor :project, :current_user, :params, :chat_name
def initialize(project, chat_name, params = {})
- @project, @current_user, @params = project, chat_name.user, params.dup
+ @project = project
+ @current_user = chat_name.user
+ @params = params.dup
@chat_name = chat_name
end
diff --git a/lib/gitlab/slash_commands/presenters/issue_new.rb b/lib/gitlab/slash_commands/presenters/issue_new.rb
index 552456f5836..8841fef702e 100644
--- a/lib/gitlab/slash_commands/presenters/issue_new.rb
+++ b/lib/gitlab/slash_commands/presenters/issue_new.rb
@@ -12,16 +12,18 @@ module Gitlab
private
- def fallback_message
- "New issue #{issue.to_reference}: #{issue.title}"
+ def pretext
+ "I created an issue on #{author_profile_link}'s behalf: *#{issue_link}* in #{project_link}"
end
- def fields_with_markdown
- %i(title pretext text fields)
+ def issue_link
+ "[#{issue.to_reference}](#{project_issue_url(issue.project, issue)})"
end
- def pretext
- "I created an issue on #{author_profile_link}'s behalf: *#{issue.to_reference}* in #{project_link}"
+ def response_message(custom_pretext: pretext)
+ {
+ text: pretext
+ }
end
end
end
diff --git a/lib/gitlab/slash_commands/run.rb b/lib/gitlab/slash_commands/run.rb
index 10a545e28ac..40fd7ee4f20 100644
--- a/lib/gitlab/slash_commands/run.rb
+++ b/lib/gitlab/slash_commands/run.rb
@@ -5,7 +5,7 @@ module Gitlab
# Slash command for triggering chatops jobs.
class Run < BaseCommand
def self.match(text)
- /\Arun\s+(?<command>\S+)(\s+(?<arguments>.+))?\z/.match(text)
+ /\Arun\s+(?<command>\S+)(\s+(?<arguments>.+))?\z/m.match(text)
end
def self.help_message