From d87a2fcd7eb8f5cf9b7dfd1fc421de1d79db1895 Mon Sep 17 00:00:00 2001 From: xxqfamous Date: Wed, 7 Jun 2023 13:56:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=94=A8=E6=88=B7fork?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E7=9A=84=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/forks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/forks_controller.rb b/app/controllers/forks_controller.rb index 53b043f49..7d7db9350 100644 --- a/app/controllers/forks_controller.rb +++ b/app/controllers/forks_controller.rb @@ -12,7 +12,7 @@ class ForksController < ApplicationController def authenticate_project! if current_user&.id == @project.user_id && (params[:new_identifier].blank? || params[:new_identifier] == @project.identifier) render_result(-1, "自己不能fork自己的项目") - elsif Project.exists?(user_id: current_user.id, identifier: @project.identifier) + elsif Project.exists?(user_id: current_user.id, identifier: (params[:new_identifier] || @project.identifier)) render_result(0, "fork失败,你已拥有了这个项目") end # return if current_user != @project.owner