From ca8597519789b2cc9ea75659b466cb51d605da3f Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 22 Aug 2023 11:42:26 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20fork=E5=90=8E=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E9=A1=B9=E7=9B=AE=E6=A0=87=E8=AF=86=E5=86=8Dforked?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/forks_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/forks_controller.rb b/app/controllers/forks_controller.rb index 93fe9a48d..44b176f82 100644 --- a/app/controllers/forks_controller.rb +++ b/app/controllers/forks_controller.rb @@ -12,6 +12,9 @@ class ForksController < ApplicationController def authenticate_project! if current_user&.id == @project.user_id render_result(-1, "自己不能fork自己的项目") + elsif ForkUser.exists?(fork_project_id: @project.id, user_id: current_user.id) + fork = ForkUser.find_by(fork_project_id: @project.id, user_id: current_user.id) + render json: { status: -1, identifier: fork.fork_project&.identifier, message: "fork失败,你已拥有了这个项目" } elsif Project.exists?(user_id: current_user.id, identifier: @project.identifier) render_result(0, "fork失败,你已拥有了这个项目") end