diff --git a/models/repo/repo.go b/models/repo/repo.go index 8d211caf40..ee9cbc0847 100644 --- a/models/repo/repo.go +++ b/models/repo/repo.go @@ -597,7 +597,7 @@ func (repo *Repository) IsOwnedBy(userID int64) bool { // CanCreateBranch returns true if repository meets the requirements for creating new branches. func (repo *Repository) CanCreateBranch() bool { - return !repo.IsMirror + return !repo.IsMirror && !repo.IsArchived } // CanEnablePulls returns true if repository meets the requirements of accepting pulls. diff --git a/routers/web/repo/issue_view.go b/routers/web/repo/issue_view.go index 3c31a41a3d..0cb9a70eab 100644 --- a/routers/web/repo/issue_view.go +++ b/routers/web/repo/issue_view.go @@ -990,4 +990,7 @@ func prepareIssueViewSidebarDevLinks(ctx *context.Context, issue *issues_model.I } ctx.Data["AllowedRepos"] = allowedRepos + ctx.Data["ShowCreateBranchLink"] = !ctx.Repo.Repository.IsEmpty && + ctx.Repo.Repository.CanCreateBranch() && + len(allowedRepos) > 0 && !issue.IsClosed } diff --git a/templates/repo/issue/sidebar/development.tmpl b/templates/repo/issue/sidebar/development.tmpl index 277dc8cc42..522fd99a32 100644 --- a/templates/repo/issue/sidebar/development.tmpl +++ b/templates/repo/issue/sidebar/development.tmpl @@ -4,7 +4,7 @@ {{ctx.Locale.Tr "repo.issues.development"}}