Feature: Archive repos (#5009)

This commit is contained in:
kolaente 2019-01-23 19:58:38 +01:00 committed by techknowlogick
parent 6ad834e236
commit 0b510725c9
30 changed files with 437 additions and 244 deletions

View file

@ -186,8 +186,9 @@ type Repository struct {
NumOpenMilestones int `xorm:"-"`
NumReleases int `xorm:"-"`
IsPrivate bool `xorm:"INDEX"`
IsEmpty bool `xorm:"INDEX"`
IsPrivate bool `xorm:"INDEX"`
IsEmpty bool `xorm:"INDEX"`
IsArchived bool `xorm:"INDEX"`
IsMirror bool `xorm:"INDEX"`
*Mirror `xorm:"-"`
@ -292,6 +293,7 @@ func (repo *Repository) innerAPIFormat(e Engine, mode AccessMode, isParent bool)
Description: repo.Description,
Private: repo.IsPrivate,
Empty: repo.IsEmpty,
Archived: repo.IsArchived,
Size: int(repo.Size / 1024),
Fork: repo.IsFork,
Parent: parent,
@ -2341,6 +2343,13 @@ func CheckRepoStats() {
// ***** END: Repository.NumForks *****
}
// SetArchiveRepoState sets if a repo is archived
func (repo *Repository) SetArchiveRepoState(isArchived bool) (err error) {
repo.IsArchived = isArchived
_, err = x.Where("id = ?", repo.ID).Cols("is_archived").Update(repo)
return
}
// ___________ __
// \_ _____/__________| | __
// | __)/ _ \_ __ \ |/ /