diff options
author | zeripath <art27@cantab.net> | 2021-11-22 22:32:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-22 22:32:16 +0000 |
commit | 1dbc58f742febbe58df59d4ce4148d2dbec1a20f (patch) | |
tree | 4b73978cdcbdff2e88752d8bbfa21478856d4305 /templates/repo/header.tmpl | |
parent | baed01f24753afb600a2984dcb9bcda0bb8502b6 (diff) | |
download | gitea-1dbc58f742febbe58df59d4ce4148d2dbec1a20f.tar.gz gitea-1dbc58f742febbe58df59d4ce4148d2dbec1a20f.zip |
More pleasantly handle broken or missing git repositories (#17747)
* More pleasantly handle broken or missing git repositories
In #17742 it was noted that there a completely invalid git repository underlying a
repo on gitea.com. This happened due to a problem during a migration however, it
is not beyond the realms of possibility that a corruption could occur to another
user.
This PR adds a check to RepoAssignment that will detect if a repository loading has
failed due to an absent git repository. It will then show a page suggesting the user
contacts the administrator or deletes the repository.
Fix #17742
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update options/locale/locale_en-US.ini
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'templates/repo/header.tmpl')
-rw-r--r-- | templates/repo/header.tmpl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 554456d230..4fb5e1941b 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -40,7 +40,7 @@ {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}} {{if .IsGenerated}}<div class="fork-flag">{{$.i18n.Tr "repo.generated_from"}} <a href="{{.TemplateRepo.Link}}">{{.TemplateRepo.FullName}}</a></div>{{end}} </div> - {{if not .IsBeingCreated}} + {{if not (or .IsBeingCreated .IsBroken)}} <div class="repo-buttons"> {{if $.RepoTransfer}} <form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}"> @@ -100,7 +100,7 @@ </div><!-- end container --> {{end}} <div class="ui tabs container"> - {{if not .Repository.IsBeingCreated}} + {{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}} <div class="ui tabular stackable menu navbar"> {{if .Permission.CanRead $.UnitTypeCode}} <a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL}}{{end}}"> @@ -172,6 +172,14 @@ </div> {{end}} </div> + {{else if .Permission.IsAdmin}} + <div class="ui tabular stackable menu navbar"> + <div class="right menu"> + <a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings"> + {{svg "octicon-tools"}} {{.i18n.Tr "repo.settings"}} + </a> + </div> + </div> {{end}} </div> <div class="ui tabs divider"></div> |