diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-01-31 11:40:27 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-01-31 11:40:27 +0000 |
commit | e4bcdddfa79d855e7f320a8d91e79e17d2e1bf5f (patch) | |
tree | 773ec4112b83aed98c1c4faefd1b0f60e2640d7c /app | |
parent | 223f1f3d2dd95d6b87a485ce0df6f4fef77eb522 (diff) | |
parent | bd5245dba67b4aa4fccce819e4491259d568240b (diff) | |
download | gitlab-ce-e4bcdddfa79d855e7f320a8d91e79e17d2e1bf5f.tar.gz |
Merge branch 'zj-display-error-team-fetch' into 'master'
Fix inconsistent return type
Closes #27150
See merge request !8290
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/mattermosts_controller.rb | 2 | ||||
-rw-r--r-- | app/models/project_services/mattermost_slash_commands_service.rb | 4 | ||||
-rw-r--r-- | app/views/projects/mattermosts/_no_teams.html.haml | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/projects/mattermosts_controller.rb b/app/controllers/projects/mattermosts_controller.rb index 01d99c7df35..38f7e6eb5e9 100644 --- a/app/controllers/projects/mattermosts_controller.rb +++ b/app/controllers/projects/mattermosts_controller.rb @@ -34,7 +34,7 @@ class Projects::MattermostsController < Projects::ApplicationController end def teams - @teams ||= @service.list_teams(current_user) + @teams, @teams_error_message = @service.list_teams(current_user) end def service diff --git a/app/models/project_services/mattermost_slash_commands_service.rb b/app/models/project_services/mattermost_slash_commands_service.rb index 50a011db74e..b0f7a42f9a3 100644 --- a/app/models/project_services/mattermost_slash_commands_service.rb +++ b/app/models/project_services/mattermost_slash_commands_service.rb @@ -28,8 +28,8 @@ class MattermostSlashCommandsService < ChatSlashCommandsService [false, e.message] end - def list_teams(user) - Mattermost::Team.new(user).all + def list_teams(current_user) + [Mattermost::Team.new(current_user).all, nil] rescue Mattermost::Error => e [[], e.message] end diff --git a/app/views/projects/mattermosts/_no_teams.html.haml b/app/views/projects/mattermosts/_no_teams.html.haml index 605c7f61dee..aac74a25b75 100644 --- a/app/views/projects/mattermosts/_no_teams.html.haml +++ b/app/views/projects/mattermosts/_no_teams.html.haml @@ -1,3 +1,7 @@ +- if @teams_error_message + = content_for :flash_message do + .alert.alert-danger= @teams_error_message + %p You aren’t a member of any team on the Mattermost instance at %strong= Gitlab.config.mattermost.host |