Skip to content

Commit

Permalink
Add error info if no user can fork the repo (#25820)
Browse files Browse the repository at this point in the history
  • Loading branch information
yp05327 authored Jul 14, 2023
1 parent 61c9268 commit 52f4691
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ fork_from = Fork From
already_forked = You've already forked %s
fork_to_different_account = Fork to a different account
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
clone_in_vsc = Clone in VS Code
download_zip = Download ZIP
Expand Down
6 changes: 6 additions & 0 deletions routers/web/repo/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ func getForkRepository(ctx *context.Context) *repo_model.Repository {
ctx.Data["ContextUser"] = ctx.Doer
} else if len(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
Expand Down

0 comments on commit 52f4691

Please sign in to comment.