Fix to display notice when project settings updated.

Change validity checking for UpdateService.

Add return value for project update service.

Return 302(redirect_to) when successfully updated.

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
sandish chen 2016-10-21 02:19:33 +00:00 committed by Rémy Coutable
parent 28f633a96a
commit 81f7a7ab62
4 changed files with 8 additions and 3 deletions

View File

@ -42,13 +42,13 @@ class ProjectsController < Projects::ApplicationController
end
def update
status = ::Projects::UpdateService.new(@project, current_user, project_params).execute
project = ::Projects::UpdateService.new(@project, current_user, project_params).execute
# Refresh the repo in case anything changed
@repository = project.repository
respond_to do |format|
if status
if project.valid?
flash[:notice] = "Project '#{@project.name}' was successfully updated."
format.html do
redirect_to(

View File

@ -24,6 +24,7 @@ module Projects
project.rename_repo
end
end
project
end
end
end

View File

@ -0,0 +1,4 @@
---
title: Fix none display notice when project settings updated
merge_request:
author: Sandish Chen

View File

@ -245,7 +245,7 @@ describe ProjectsController do
expect(project.repository.path).to include(new_path)
expect(assigns(:repository).path).to eq(project.repository.path)
expect(response).to have_http_status(200)
expect(response).to have_http_status(302)
end
end