Commit 89af76ed authored by Rémy Coutable's avatar Rémy Coutable

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
parents ae1da08f b76ef40e
...@@ -41,6 +41,7 @@ v 8.12.0 (unreleased) ...@@ -41,6 +41,7 @@ v 8.12.0 (unreleased)
- Fix markdown help references (ClemMakesApps) - Fix markdown help references (ClemMakesApps)
- Add last commit time to repo view (ClemMakesApps) - Add last commit time to repo view (ClemMakesApps)
- Fix accessibility and visibility of project list dropdown button !6140 - 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 - Added project specific enable/disable setting for LFS !5997
- Don't expose a user's token in the `/api/v3/user` API (!6047) - Don't expose a user's token in the `/api/v3/user` API (!6047)
- Remove redundant js-timeago-pending from user activity log (ClemMakesApps) - Remove redundant js-timeago-pending from user activity log (ClemMakesApps)
......
...@@ -20,9 +20,8 @@ class Projects::ServicesController < Projects::ApplicationController ...@@ -20,9 +20,8 @@ class Projects::ServicesController < Projects::ApplicationController
def update def update
if @service.update_attributes(service_params[:service]) if @service.update_attributes(service_params[:service])
redirect_to( redirect_to(
edit_namespace_project_service_path(@project.namespace, @project, edit_namespace_project_service_path(@project.namespace, @project, @service.to_param),
@service.to_param, notice: notice: 'Successfully updated.'
'Successfully updated.')
) )
else else
render 'edit' render 'edit'
......
...@@ -49,4 +49,20 @@ describe Projects::ServicesController do ...@@ -49,4 +49,20 @@ describe Projects::ServicesController do
let!(:referrer) { nil } let!(:referrer) { nil }
end end
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 end
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