mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Add error info if no user can fork the repo (#25820)
Before: (Owner list is empty)  After: (Disable the button and show the error info) 
This commit is contained in:
		@@ -935,6 +935,7 @@ fork_from = Fork From
 | 
				
			|||||||
already_forked = You've already forked %s
 | 
					already_forked = You've already forked %s
 | 
				
			||||||
fork_to_different_account = Fork to a different account
 | 
					fork_to_different_account = Fork to a different account
 | 
				
			||||||
fork_visibility_helper = The visibility of a forked repository cannot be changed.
 | 
					fork_visibility_helper = The visibility of a forked repository cannot be changed.
 | 
				
			||||||
 | 
					fork_no_valid_owners = This repository can not be forked because there are no valid owners.
 | 
				
			||||||
use_template = Use this template
 | 
					use_template = Use this template
 | 
				
			||||||
clone_in_vsc = Clone in VS Code
 | 
					clone_in_vsc = Clone in VS Code
 | 
				
			||||||
download_zip = Download ZIP
 | 
					download_zip = Download ZIP
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -174,6 +174,12 @@ func getForkRepository(ctx *context.Context) *repo_model.Repository {
 | 
				
			|||||||
		ctx.Data["ContextUser"] = ctx.Doer
 | 
							ctx.Data["ContextUser"] = ctx.Doer
 | 
				
			||||||
	} else if len(orgs) > 0 {
 | 
						} else if len(orgs) > 0 {
 | 
				
			||||||
		ctx.Data["ContextUser"] = orgs[0]
 | 
							ctx.Data["ContextUser"] = orgs[0]
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							msg := ctx.Tr("repo.fork_no_valid_owners")
 | 
				
			||||||
 | 
							ctx.Data["Flash"] = ctx.Flash
 | 
				
			||||||
 | 
							ctx.Flash.Error(msg)
 | 
				
			||||||
 | 
							ctx.Data["CanForkRepo"] = false
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return forkRepo
 | 
						return forkRepo
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user