gitlab-org--gitlab-foss/app/controllers/projects/forks_controller.rb
Vinnie Okada 2a9eed6620 Merge branch 'master' into rails-4.1.9
Conflicts:
	app/views/projects/commits/_commit.html.haml
	app/views/projects/issues/_issue.html.haml
	app/views/projects/issues/_issue_context.html.haml
	app/views/projects/merge_requests/_merge_request.html.haml
	app/views/projects/merge_requests/show/_context.html.haml
2015-02-21 12:55:28 -07:00

25 lines
739 B
Ruby

class Projects::ForksController < Projects::ApplicationController
# Authorize
before_filter :require_non_empty_project
before_filter :authorize_download_code!
def new
@namespaces = current_user.manageable_namespaces
@namespaces.delete(@project.namespace)
end
def create
namespace = Namespace.find(params[:namespace_key])
@forked_project = ::Projects::ForkService.new(project, current_user, namespace: namespace).execute
if @forked_project.saved? && @forked_project.forked?
redirect_to(
namespace_project_path(@forked_project.namespace, @forked_project),
notice: 'Project was successfully forked.'
)
else
@title = 'Fork project'
render :error
end
end
end