From 0b510725c97452bac57ff0080df10f6177aa2a6e Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 23 Jan 2019 19:58:38 +0100 Subject: Feature: Archive repos (#5009) --- models/repo.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'models/repo.go') diff --git a/models/repo.go b/models/repo.go index d2b163ff65..0a00e6c7a8 100644 --- a/models/repo.go +++ b/models/repo.go @@ -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 +} + // ___________ __ // \_ _____/__________| | __ // | __)/ _ \_ __ \ |/ / -- cgit v1.2.3