diff options
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r-- | app/controllers/projects_controller.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 8e55aa01cc9..255baba0ecb 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -78,4 +78,19 @@ class ProjectsController < ProjectResourceController format.html { redirect_to root_path } end end + + def fork + @project = ::Projects::ForkContext.new(project, current_user).execute + + respond_to do |format| + format.html do + if @project.saved? && @project.forked? + redirect_to(@project, notice: 'Project was successfully forked.') + else + render action: "new" + end + end + format.js + end + end end |