diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-12-20 21:11:53 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-12-20 21:11:53 +0300 |
commit | 61d09a7b15ef9ae2e23359f1afb87b0adbda4dd4 (patch) | |
tree | 1cfeb2ebdd16c9972ad296416a4db48c30cc7637 /app/controllers/projects | |
parent | 0cf23fde7c666b64e6c18a92d29e632f51b00059 (diff) |
WIP
Diffstat (limited to 'app/controllers/projects')
-rw-r--r-- | app/controllers/projects/mattermosts_controller.rb | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/app/controllers/projects/mattermosts_controller.rb b/app/controllers/projects/mattermosts_controller.rb index 0f939838306..d87dff2a80e 100644 --- a/app/controllers/projects/mattermosts_controller.rb +++ b/app/controllers/projects/mattermosts_controller.rb @@ -12,13 +12,17 @@ class Projects::MattermostsController < Projects::ApplicationController end def create - @service.configure!(current_user, configure_params) - - flash[:notice] = 'This service is now configured' - redirect_to edit_namespace_project_service_path(@project.namespace, @project, service) - rescue => e - flash[:alert] = e.message - redirect_to new_namespace_project_mattermost_path(@project.namespace, @project) + result, message = @service.configure(current_user, configure_params) + + if result + flash[:notice] = 'This service is now configured' + redirect_to edit_namespace_project_service_path( + @project.namespace, @project, service) + else + flash[:alert] = message || 'Failed to configure service' + redirect_to new_namespace_project_mattermost_path( + @project.namespace, @project) + end end private @@ -31,9 +35,6 @@ class Projects::MattermostsController < Projects::ApplicationController def teams @teams ||= @service.list_teams(current_user) - rescue => e - @teams = [] - flash[:alert] = e.message end def service |