mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-22 20:55:46 +08:00
update fork
This commit is contained in:
@@ -26,14 +26,16 @@ class ForksController < ApplicationController
|
||||
private
|
||||
def authenticate_project!
|
||||
if params[:organization].present?
|
||||
return render_forbidden('参数错误,当组织字段存在时,不允许重命名fork仓库') if params[:new_identifier].present? || params[:new_name].present?
|
||||
return render_forbidden('参数错误,当organization存在时不允许fork重命名') if params[:new_identifier].present? || params[:new_name].present?
|
||||
@organization = Organization.find_by(login:params[:organization])
|
||||
return render_forbidden('仓库不存在') unless @organization.present?
|
||||
return render_forbidden('你没有权限操作') unless @organization.is_admin?(current_user.id)
|
||||
end
|
||||
|
||||
if params[:organization].blank? && Project.exists?(user_id: current_user.id, identifier: (params[:new_identifier] || @project.identifier))
|
||||
render_result(-2, "fork失败,您已拥有了这个项目")
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user