Merge pull request '根据前端需求调整fork返回值' (#87) from KingChan/forgeplus:chenjing into standalone_develop
This commit is contained in:
commit
a33f2f93c5
|
@ -26,14 +26,14 @@ class ForksController < ApplicationController
|
|||
private
|
||||
def authenticate_project!
|
||||
if params[:organization].present?
|
||||
return render_forbidden('参数错误,当organization存在时不允许fork重命名') if params[:new_identifier].present? || params[:new_name].present?
|
||||
return render_forbidden('参数错误,当组织字段存在时,不允许重命名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(-1, "fork失败,您已拥有了这个项目")
|
||||
render_result(-2, "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)
|
||||
|
|
Loading…
Reference in New Issue