Feature: Archive repos (#5009)
This commit is contained in:
parent
6ad834e236
commit
0b510725c9
30 changed files with 437 additions and 244 deletions
|
@ -117,6 +117,7 @@ type RepoSettingForm struct {
|
|||
EnableTimetracker bool
|
||||
AllowOnlyContributorsToTrackTime bool
|
||||
EnableIssueDependencies bool
|
||||
IsArchived bool
|
||||
|
||||
// Admin settings
|
||||
EnableHealthCheck bool
|
||||
|
|
|
@ -56,7 +56,7 @@ type Repository struct {
|
|||
|
||||
// CanEnableEditor returns true if repository is editable and user has proper access level.
|
||||
func (r *Repository) CanEnableEditor() bool {
|
||||
return r.Permission.CanWrite(models.UnitTypeCode) && r.Repository.CanEnableEditor() && r.IsViewBranch
|
||||
return r.Permission.CanWrite(models.UnitTypeCode) && r.Repository.CanEnableEditor() && r.IsViewBranch && !r.Repository.IsArchived
|
||||
}
|
||||
|
||||
// CanCreateBranch returns true if repository is editable and user has proper access level.
|
||||
|
@ -64,6 +64,15 @@ func (r *Repository) CanCreateBranch() bool {
|
|||
return r.Permission.CanWrite(models.UnitTypeCode) && r.Repository.CanCreateBranch()
|
||||
}
|
||||
|
||||
// RepoMustNotBeArchived checks if a repo is archived
|
||||
func RepoMustNotBeArchived() macaron.Handler {
|
||||
return func(ctx *Context) {
|
||||
if ctx.Repo.Repository.IsArchived {
|
||||
ctx.NotFound("IsArchived", fmt.Errorf(ctx.Tr("repo.archive.title")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CanCommitToBranch returns true if repository is editable and user has proper access level
|
||||
// and branch is not protected for push
|
||||
func (r *Repository) CanCommitToBranch(doer *models.User) (bool, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue