Commit 81f7a7ab authored by sandish chen's avatar sandish chen Committed by Rémy Coutable

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: default avatarRémy Coutable <remy@rymai.me>
parent 28f633a9
...@@ -42,13 +42,13 @@ class ProjectsController < Projects::ApplicationController ...@@ -42,13 +42,13 @@ class ProjectsController < Projects::ApplicationController
end end
def update 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 # Refresh the repo in case anything changed
@repository = project.repository @repository = project.repository
respond_to do |format| respond_to do |format|
if status if project.valid?
flash[:notice] = "Project '#{@project.name}' was successfully updated." flash[:notice] = "Project '#{@project.name}' was successfully updated."
format.html do format.html do
redirect_to( redirect_to(
......
...@@ -24,6 +24,7 @@ module Projects ...@@ -24,6 +24,7 @@ module Projects
project.rename_repo project.rename_repo
end end
end end
project
end end
end end
end end
---
title: Fix none display notice when project settings updated
merge_request:
author: Sandish Chen
...@@ -245,7 +245,7 @@ describe ProjectsController do ...@@ -245,7 +245,7 @@ describe ProjectsController do
expect(project.repository.path).to include(new_path) expect(project.repository.path).to include(new_path)
expect(assigns(:repository).path).to eq(project.repository.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
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