Merge pull request #9771 from kazubu/fix_error_destroy_without_referer
Fix: 500 error returned if destroy request without HTTP referer
This commit is contained in:
commit
98cc695afb
|
@ -11,6 +11,7 @@ v 8.2.0 (unreleased)
|
||||||
- Fix: Inability to reply to code comments in the MR view, if the MR comes from a fork
|
- Fix: Inability to reply to code comments in the MR view, if the MR comes from a fork
|
||||||
- Use git follow flag for commits page when retrieve history for file or directory
|
- Use git follow flag for commits page when retrieve history for file or directory
|
||||||
- Show merge request CI status on merge requests index page
|
- Show merge request CI status on merge requests index page
|
||||||
|
- Fix: 500 error returned if destroy request without HTTP referer (Kazuki Shimizu)
|
||||||
|
|
||||||
v 8.1.1
|
v 8.1.1
|
||||||
- Fix cloning Wiki repositories via HTTP (Stan Hu)
|
- Fix cloning Wiki repositories via HTTP (Stan Hu)
|
||||||
|
|
|
@ -124,11 +124,7 @@ class ProjectsController < ApplicationController
|
||||||
::Projects::DestroyService.new(@project, current_user, {}).execute
|
::Projects::DestroyService.new(@project, current_user, {}).execute
|
||||||
flash[:alert] = "Project '#{@project.name}' was deleted."
|
flash[:alert] = "Project '#{@project.name}' was deleted."
|
||||||
|
|
||||||
if request.referer.include?('/admin')
|
redirect_back_or_default(default: dashboard_projects_path, options: {})
|
||||||
redirect_to admin_namespaces_projects_path
|
|
||||||
else
|
|
||||||
redirect_to dashboard_projects_path
|
|
||||||
end
|
|
||||||
rescue Projects::DestroyService::DestroyError => ex
|
rescue Projects::DestroyService::DestroyError => ex
|
||||||
redirect_to edit_project_path(@project), alert: ex.message
|
redirect_to edit_project_path(@project), alert: ex.message
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue