diff options
author | Rémy Coutable <remy@rymai.me> | 2016-09-05 12:28:14 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-09-05 12:28:14 +0000 |
commit | 89af76edc5e44ad1a0a55a65337bb992355911a6 (patch) | |
tree | 677ffa0b0fbf061a5ab393a02ca4dd504a4d37a7 | |
parent | ae1da08f25e6253c1d58ac24214a63572bf533db (diff) | |
parent | b76ef40e36c70b18fc655a153c08c8814b6edf89 (diff) | |
download | gitlab-ce-89af76edc5e44ad1a0a55a65337bb992355911a6.tar.gz |
Merge branch 'fix-missing-flash-messages' into 'master'
Fix missing flash messages on service edit page
## What does this MR do?
This MR fixes missing post-update flash notifications for service edit page. Bug was introduced in https://gitlab.com/gitlab-org/gitlab-ce/commit/76aad9b76ed756ca9ba2cbcdb399c815e542b3ae#3ca7aff54d2814b971a98a7bf2837e07ab3dfa04_21_20 and caused by passing `notice: Successfully updated.` to path helper instead of passing it to `redirect_to` due to wrong parenthesis placement.
## Why was this MR needed?
While adding HipChat integration I noticed that no messages are being displayed after clicking on "Save changes" button. I looked into code and observed that there is a code for these messages which once worked but doesn't work anymore. It's a regression which should be fixed.
## Screenshots (if relevant)
![image](/uploads/32b851e5bdc2a6438f35061473db9650/image.png)
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
- [x] Added for this feature/bug
- [x] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !6195
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/controllers/projects/services_controller.rb | 5 | ||||
-rw-r--r-- | spec/controllers/projects/services_controller_spec.rb | 16 |
3 files changed, 19 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index 2e4ca241348..ae6812612d2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -41,6 +41,7 @@ v 8.12.0 (unreleased) - Fix markdown help references (ClemMakesApps) - Add last commit time to repo view (ClemMakesApps) - Fix accessibility and visibility of project list dropdown button !6140 + - Fix missing flash messages on service edit page (airatshigapov) - Added project specific enable/disable setting for LFS !5997 - Don't expose a user's token in the `/api/v3/user` API (!6047) - Remove redundant js-timeago-pending from user activity log (ClemMakesApps) diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index 6a227d85f6f..97e6e9471e0 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -20,9 +20,8 @@ class Projects::ServicesController < Projects::ApplicationController def update if @service.update_attributes(service_params[:service]) redirect_to( - edit_namespace_project_service_path(@project.namespace, @project, - @service.to_param, notice: - 'Successfully updated.') + edit_namespace_project_service_path(@project.namespace, @project, @service.to_param), + notice: 'Successfully updated.' ) else render 'edit' diff --git a/spec/controllers/projects/services_controller_spec.rb b/spec/controllers/projects/services_controller_spec.rb index cccd492ef06..2e44b5128b4 100644 --- a/spec/controllers/projects/services_controller_spec.rb +++ b/spec/controllers/projects/services_controller_spec.rb @@ -49,4 +49,20 @@ describe Projects::ServicesController do let!(:referrer) { nil } end end + + describe 'PUT #update' do + context 'on successful update' do + it 'sets the flash' do + expect(service).to receive(:to_param).and_return('hipchat') + + put :update, + namespace_id: project.namespace.id, + project_id: project.id, + id: service.id, + service: { active: false } + + expect(flash[:notice]).to eq 'Successfully updated.' + end + end + end end |