summaryrefslogtreecommitdiffstats
path: root/modules/convert/repository.go
diff options
context:
space:
mode:
authorPeter GardfjÀll <peter.gardfjall.work@gmail.com>2022-01-18 14:18:30 +0100
committerGitHub <noreply@github.com>2022-01-18 13:18:30 +0000
commit89a321435259afa911900c0047f2766d255d315b (patch)
tree6de3e83e6fc171c8b3c273c6b4d45eb760d79695 /modules/convert/repository.go
parent68b59d89669897b8dd1d5da6a470e02601819375 (diff)
downloadgitea-89a321435259afa911900c0047f2766d255d315b.tar.gz
gitea-89a321435259afa911900c0047f2766d255d315b.zip
Add MirrorUpdated field to Repository API type (#18267)
Add the last update time to the repository api type. Close #18266
Diffstat (limited to 'modules/convert/repository.go')
-rw-r--r--modules/convert/repository.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/convert/repository.go b/modules/convert/repository.go
index 725b04e2ca..459f98f396 100644
--- a/modules/convert/repository.go
+++ b/modules/convert/repository.go
@@ -5,6 +5,8 @@
package convert
import (
+ "time"
+
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/perm"
@@ -99,11 +101,13 @@ func innerToRepo(repo *repo_model.Repository, mode perm.AccessMode, isParent boo
numReleases, _ := models.GetReleaseCountByRepoID(repo.ID, models.FindReleasesOptions{IncludeDrafts: false, IncludeTags: false})
mirrorInterval := ""
+ var mirrorUpdated time.Time
if repo.IsMirror {
var err error
repo.Mirror, err = repo_model.GetMirrorByRepoID(repo.ID)
if err == nil {
mirrorInterval = repo.Mirror.Interval.String()
+ mirrorUpdated = repo.Mirror.UpdatedUnix.AsTime()
}
}
@@ -166,6 +170,7 @@ func innerToRepo(repo *repo_model.Repository, mode perm.AccessMode, isParent boo
AvatarURL: repo.AvatarLink(),
Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate,
MirrorInterval: mirrorInterval,
+ MirrorUpdated: mirrorUpdated,
RepoTransfer: transfer,
}
}