diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-02-22 20:34:04 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-02-23 16:37:53 +0300 |
commit | 57719d34d3fcc15f39354b0e9dc1da41bbe5d1a8 (patch) | |
tree | 255d9a3df371793748c64792a715102dca98512c /app/models/project_services | |
parent | c679fa163148601e77803f45cf5dea8e1b3feb0a (diff) |
Expose ChatName objects to slash commands
Instead of only exposing a User to slash commands we now also expose the
ChatName object that the User object is retrieved from. This is
necessary for GitLab Chatops as we need for example the user ID of the
chat user.
Diffstat (limited to 'app/models/project_services')
-rw-r--r-- | app/models/project_services/slash_commands_service.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/project_services/slash_commands_service.rb b/app/models/project_services/slash_commands_service.rb index eb4da68bb7e..37ea45109ae 100644 --- a/app/models/project_services/slash_commands_service.rb +++ b/app/models/project_services/slash_commands_service.rb @@ -30,10 +30,10 @@ class SlashCommandsService < Service def trigger(params) return unless valid_token?(params[:token]) - user = find_chat_user(params) + chat_user = find_chat_user(params) - if user - Gitlab::SlashCommands::Command.new(project, user, params).execute + if chat_user&.user + Gitlab::SlashCommands::Command.new(project, chat_user, params).execute else url = authorize_chat_name_url(params) Gitlab::SlashCommands::Presenters::Access.new(url).authorize |