diff --git a/app/views/projects/mattermosts/_no_teams.html.haml b/app/views/projects/mattermosts/_no_teams.html.haml index 605c7f61dee2355566f7451e874298e6172601d5..1bb3642431e56becd9f328c790567758b66afa16 100644 --- a/app/views/projects/mattermosts/_no_teams.html.haml +++ b/app/views/projects/mattermosts/_no_teams.html.haml @@ -1,3 +1,6 @@ += content_for :flash_message do + .alert.alert-danger= @teams if @teams.is_a?(String) + %p You aren鈥檛 a member of any team on the Mattermost instance at %strong= Gitlab.config.mattermost.host diff --git a/app/views/projects/mattermosts/new.html.haml b/app/views/projects/mattermosts/new.html.haml index 96b1d2aee61dd72fdaf213af327d565bc29ed59d..82f596da0fea2422e0844a29c3c237bdffc8819f 100644 --- a/app/views/projects/mattermosts/new.html.haml +++ b/app/views/projects/mattermosts/new.html.haml @@ -2,7 +2,7 @@ .inline.pull-right = custom_icon('mattermost_logo', size: 48) %h3 Install Mattermost Command - - if @teams.empty? + - if @teams.is_a?(String) || @teams.empty? = render 'no_teams' - else = render 'team_selection' diff --git a/spec/features/projects/services/mattermost_slash_command_spec.rb b/spec/features/projects/services/mattermost_slash_command_spec.rb index 86a07b2c679cef209b3bade257591a918581c5ef..6737b85e0d18ea0232200dcf33d1743fc4a81309 100644 --- a/spec/features/projects/services/mattermost_slash_command_spec.rb +++ b/spec/features/projects/services/mattermost_slash_command_spec.rb @@ -99,6 +99,15 @@ feature 'Setup Mattermost slash commands', feature: true do expect(select_element.all('option').count).to eq(3) end + it 'shows an error alert with the error message if there is an error requesting teams' do + allow_any_instance_of(MattermostSlashCommandsService).to receive(:list_teams) { 'test mattermost error message' } + + click_link 'Add to Mattermost' + + expect(page).to have_selector('.alert') + expect(page).to have_content('test mattermost error message') + end + def stub_teams(count: 0) teams = create_teams(count)