From 7576e37a65729363370d6672ff6e69e87b68ac5f Mon Sep 17 00:00:00 2001 From: Paul Barton <28630076+paulbarton90@users.noreply.github.com> Date: Sat, 2 Jan 2021 23:47:47 +0000 Subject: Add MirrorInterval to the API (#14163) * Added MirrorInterval to the API * Remove MirrorInterval from CreateRepository * Removed Duplicate UpdateMirror Function * Updated Error Logging * Update Log Message for is not Mirror Co-authored-by: 6543 <6543@obermui.de> * Delete Debug Statement that snuck in Co-authored-by: zeripath * Add Check for If Interval is too small * Output to API Call * Add Error Object when time is Less than Min Interval * Frequency Error Message Co-authored-by: zeripath * Allow Zero Mirror Interval Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath --- modules/convert/repository.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules/convert') diff --git a/modules/convert/repository.go b/modules/convert/repository.go index 0f470144b4..813201ca68 100644 --- a/modules/convert/repository.go +++ b/modules/convert/repository.go @@ -91,6 +91,13 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool) numReleases, _ := models.GetReleaseCountByRepoID(repo.ID, models.FindReleasesOptions{IncludeDrafts: false, IncludeTags: true}) + mirrorInterval := "" + if repo.IsMirror { + if err := repo.GetMirror(); err == nil { + mirrorInterval = repo.Mirror.Interval.String() + } + } + return &api.Repository{ ID: repo.ID, Owner: ToUser(repo.Owner, mode != models.AccessModeNone, mode >= models.AccessModeAdmin), @@ -134,5 +141,6 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool) AllowSquash: allowSquash, AvatarURL: repo.AvatarLink(), Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate, + MirrorInterval: mirrorInterval, } } -- cgit v1.2.3