summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2016-12-16 20:29:17 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2016-12-16 20:29:17 +0100
commitf0889bdfa3e0d1433b3cd293859b13ee9d186ab6 (patch)
tree72816bc5d3a82689efa17e026b339a1c8f130e5c /app/models
parent7363a7d3b5804493f86531bebb1610afb91b5293 (diff)
downloadgitlab-ce-f0889bdfa3e0d1433b3cd293859b13ee9d186ab6.tar.gz
Incorporate review
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project_services/mattermost_slash_commands_service.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/app/models/project_services/mattermost_slash_commands_service.rb b/app/models/project_services/mattermost_slash_commands_service.rb
index 5af85d9a598..5dfc4cc2744 100644
--- a/app/models/project_services/mattermost_slash_commands_service.rb
+++ b/app/models/project_services/mattermost_slash_commands_service.rb
@@ -25,15 +25,12 @@ class MattermostSlashCommandsService < ChatService
]
end
- def configure(host, current_user, team_id:, trigger:, url:, icon_url:)
+ def configure(host, current_user, params)
new_token = Mattermost::Session.new(host, current_user).with_session do
- Mattermost::Command.create(team_id,
- trigger: trigger || @service.project.path,
- url: url,
- icon_url: icon_url)
+ Mattermost::Command.create(params[:team_id], command)
end
- update!(token: new_token)
+ update!(token: new_token, active: true)
end
def trigger(params)
@@ -50,6 +47,23 @@ class MattermostSlashCommandsService < ChatService
private
+ def command(trigger:, url:, icon_url:)
+ pretty_project_name = project.name_with_namespace
+
+ {
+ auto_complete: true,
+ auto_complete_desc: "Perform common operations on: #{pretty_project_name}",
+ auto_complete_hint: '[help]',
+ description: "Perform common operations on: #{pretty_project_name}",
+ display_name: "GitLab / #{pretty_project_name}",
+ method: 'P',
+ user_name: 'GitLab',
+ trigger: trigger,
+ url: url,
+ icon_url: icon_url
+ }
+ end
+
def find_chat_user(params)
ChatNames::FindUserService.new(self, params).execute
end