Commit 7c5872c1 authored by Yorick Peterse's avatar Yorick Peterse

Expose ChatName in GlobalSlackHandler

parent 36335ba9
......@@ -22,10 +22,10 @@ module SlashCommands
service = integration.service
project = service.project
user = ChatNames::FindUserService.new(service, params).execute
chat_user = ChatNames::FindUserService.new(service, params).execute
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 = ChatNames::AuthorizeUserService.new(service, params).execute
Gitlab::SlashCommands::Presenters::Access.new(url).authorize
......
......@@ -3,6 +3,7 @@ require 'spec_helper'
describe SlashCommands::GlobalSlackHandler do
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:chat_name) { double(:chat_name, user: user) }
let(:verification_token) { '123' }
before do
......@@ -32,7 +33,7 @@ describe SlashCommands::GlobalSlackHandler do
context 'Valid token' do
it 'calls command handler if project alias is valid' do
expect_any_instance_of(Gitlab::SlashCommands::Command).to receive(:execute)
expect_any_instance_of(ChatNames::FindUserService).to receive(:execute).and_return(user)
expect_any_instance_of(ChatNames::FindUserService).to receive(:execute).and_return(chat_name)
enable_slack_application(project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment