mirror of
https://github.com/go-gitea/gitea
synced 2024-12-21 18:17:57 +01:00
Empty, mirror & archived repository will not allow create branch
This commit is contained in:
parent
da7f700d28
commit
832b78eb69
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
<span class="text"><strong>{{ctx.Locale.Tr "repo.issues.development"}}</strong></span>
|
||||
<div class="ui devlinks list">
|
||||
{{/* AllowedRepos not empty means login user can create new branch in some of the repositories */}}
|
||||
{{if and (not .Issue.IsClosed) .AllowedRepos}}
|
||||
{{if .ShowCreateBranchLink}}
|
||||
<div class="tw-items-center">
|
||||
<a class="tw-mt-1 fluid ui show-modal" data-modal="#create_branch">{{ctx.Locale.Tr "repo.branch.new_branch"}}</a>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user