From ba9bb1513f58cfdcf61ba9d0f0af01a3b796978b Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Mon, 20 Feb 2023 11:58:12 +0900
Subject: [PATCH 1/2] remove CanForkRepo
---
routers/web/repo/pull.go | 4 +---
templates/repo/pulls/fork.tmpl | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index c7a59da8a8b1..5ce6704c4f13 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -182,9 +182,7 @@ func getForkRepository(ctx *context.Context) *repo_model.Repository {
func Fork(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("new_fork")
- if ctx.Doer.CanForkRepo() {
- ctx.Data["CanForkRepo"] = true
- } else {
+ if !ctx.Doer.CanForkRepo() {
maxCreationLimit := ctx.Doer.MaxCreationLimit()
msg := ctx.TrN(maxCreationLimit, "repo.form.reach_limit_of_creation_1", "repo.form.reach_limit_of_creation_n", maxCreationLimit)
ctx.Data["Flash"] = ctx.Flash
diff --git a/templates/repo/pulls/fork.tmpl b/templates/repo/pulls/fork.tmpl
index 930d5afa69b2..ccc93684c7fb 100644
--- a/templates/repo/pulls/fork.tmpl
+++ b/templates/repo/pulls/fork.tmpl
@@ -58,7 +58,7 @@
-
From 2a5a88c12e0cec8b07ea03ddba4612ba50d46777 Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Fri, 17 Mar 2023 04:55:09 +0000
Subject: [PATCH 2/2] fix
---
routers/web/repo/pull.go | 5 ++++-
templates/repo/pulls/fork.tmpl | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index a65e24a2f2bf..3e1ac8c2fc86 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -182,7 +182,9 @@ func getForkRepository(ctx *context.Context) *repo_model.Repository {
func Fork(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("new_fork")
- if !ctx.Doer.CanForkRepo() {
+ if ctx.Doer.CanForkRepo() {
+ ctx.Data["CanForkRepo"] = true
+ } else {
maxCreationLimit := ctx.Doer.MaxCreationLimit()
msg := ctx.TrN(maxCreationLimit, "repo.form.reach_limit_of_creation_1", "repo.form.reach_limit_of_creation_n", maxCreationLimit)
ctx.Data["Flash"] = ctx.Flash
@@ -201,6 +203,7 @@ func Fork(ctx *context.Context) {
func ForkPost(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.CreateRepoForm)
ctx.Data["Title"] = ctx.Tr("new_fork")
+ ctx.Data["CanForkRepo"] = true
ctxUser := checkContextUser(ctx, form.UID)
if ctx.Written() {
diff --git a/templates/repo/pulls/fork.tmpl b/templates/repo/pulls/fork.tmpl
index ccc93684c7fb..930d5afa69b2 100644
--- a/templates/repo/pulls/fork.tmpl
+++ b/templates/repo/pulls/fork.tmpl
@@ -58,7 +58,7 @@
-
+
{{.locale.Tr "repo.fork_repo"}}