Skip to content

Commit 4ff1c86

Browse files
committed
use new function to apply NoAutoTime
1 parent c52953b commit 4ff1c86

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: models/repo/update.go

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ func UpdateRepositoryCols(ctx context.Context, repo *Repository, cols ...string)
4646
return err
4747
}
4848

49+
// UpdateRepositoryColsNoAutoTime updates repository's columns and but applies time change automatically
50+
func UpdateRepositoryColsNoAutoTime(ctx context.Context, repo *Repository, cols ...string) error {
51+
_, err := db.GetEngine(ctx).ID(repo.ID).Cols(cols...).NoAutoTime().Update(repo)
52+
return err
53+
}
54+
4955
// ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
5056
type ErrReachLimitOfRepo struct {
5157
Limit int

Diff for: routers/web/repo/view_home.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ func updateContextRepoEmptyAndStatus(ctx *context.Context, empty bool, status re
229229
if repo.Status == repo_model.RepositoryReady || repo.Status == repo_model.RepositoryBroken {
230230
repo.Status = status // only handle ready and broken status, leave other status as-is
231231
}
232-
if _, err := db.GetEngine(ctx).ID(repo.ID).Cols("is_empty", "status").NoAutoTime().Update(repo); err != nil {
232+
if err := repo_model.UpdateRepositoryColsNoAutoTime(ctx, ctx.Repo.Repository, "is_empty", "status"); err != nil {
233233
ctx.ServerError("updateContextRepoEmptyAndStatus: UpdateRepositoryCols", err)
234234
return
235235
}

0 commit comments

Comments
 (0)