update fork
This commit is contained in:
parent
c98e3c9d74
commit
012077923c
|
@ -30,21 +30,14 @@ class ForksController < ApplicationController
|
||||||
@organization = Organization.find_by(login:params[:organization])
|
@organization = Organization.find_by(login:params[:organization])
|
||||||
return render_forbidden('仓库不存在') unless @organization.present?
|
return render_forbidden('仓库不存在') unless @organization.present?
|
||||||
return render_forbidden('你没有权限操作') unless @organization.is_admin?(current_user.id)
|
return render_forbidden('你没有权限操作') unless @organization.is_admin?(current_user.id)
|
||||||
|
return render_result(-1, "fork失败,组织已拥有了这个项目") if @organization && Project.exists?(user_id: [@organization.id], identifier: (params[:new_identifier] || @project.identifier))
|
||||||
|
return render_result(-1, "fork失败,请联系系统管理员") if gitea_check_exit(@organization)
|
||||||
|
else
|
||||||
|
return render_result(-1, "fork失败,您已fork过了这个项目") if Project.exists?(user_id: current_user.id, forked_from_project_id: @project.id)
|
||||||
|
return render_result(-2, "fork失败, fork本人项目需要为fork仓库重命名") if Project.exists?(user_id: current_user.id, identifier: (params[:new_identifier] || @project.identifier))
|
||||||
|
return render_result(-1, "fork失败,请联系系统管理员") if gitea_check_exit(current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
if Project.exists?(user_id: current_user.id, forked_from_project_id: @project.id)
|
|
||||||
render_result(-1, "fork失败,您已fork过了这个项目")
|
|
||||||
elsif params[:organization].blank? && Project.exists?(user_id: current_user.id, identifier: (params[:new_identifier] || @project.identifier))
|
|
||||||
render_result(-2, "fork失败, fork本人项目需要为fork仓库重命名")
|
|
||||||
elsif @organization && Project.exists?(user_id: [@organization.id], identifier: (params[:new_identifier] || @project.identifier))
|
|
||||||
render_result(-1, "fork失败,组织已拥有了这个项目")
|
|
||||||
elsif gitea_check_exit(current_user)
|
|
||||||
render_result(-1, "fork失败,请联系系统管理员")
|
|
||||||
elsif @organization && gitea_check_exit(@organization)
|
|
||||||
render_result(-1, "fork失败,请联系系统管理员")
|
|
||||||
end
|
|
||||||
# return if current_user != @project.owner
|
|
||||||
# render_result(-1, "自己不能fork自己的项目")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def authenticate_user!
|
def authenticate_user!
|
||||||
|
|
Loading…
Reference in New Issue