mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	When updating mirror repo intervals by API reschedule next update too (#19429)
When a mirror repo interval is updated by the UI it is rescheduled with that interval however the API does not do this. The API also lacks the enable_prune option. This PR adds this functionality in to the API Edit Repo endpoint. Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		@@ -32,7 +32,6 @@ import (
 | 
			
		||||
	"code.gitea.io/gitea/modules/repository"
 | 
			
		||||
	"code.gitea.io/gitea/modules/setting"
 | 
			
		||||
	"code.gitea.io/gitea/modules/structs"
 | 
			
		||||
	"code.gitea.io/gitea/modules/timeutil"
 | 
			
		||||
	"code.gitea.io/gitea/modules/typesniffer"
 | 
			
		||||
	"code.gitea.io/gitea/modules/util"
 | 
			
		||||
	"code.gitea.io/gitea/modules/validation"
 | 
			
		||||
@@ -195,11 +194,7 @@ func SettingsPost(ctx *context.Context) {
 | 
			
		||||
		} else {
 | 
			
		||||
			ctx.Repo.Mirror.EnablePrune = form.EnablePrune
 | 
			
		||||
			ctx.Repo.Mirror.Interval = interval
 | 
			
		||||
			if interval != 0 {
 | 
			
		||||
				ctx.Repo.Mirror.NextUpdateUnix = timeutil.TimeStampNow().AddDuration(interval)
 | 
			
		||||
			} else {
 | 
			
		||||
				ctx.Repo.Mirror.NextUpdateUnix = 0
 | 
			
		||||
			}
 | 
			
		||||
			ctx.Repo.Mirror.ScheduleNextUpdate()
 | 
			
		||||
			if err := repo_model.UpdateMirror(ctx.Repo.Mirror); err != nil {
 | 
			
		||||
				ctx.Data["Err_Interval"] = true
 | 
			
		||||
				ctx.RenderWithErr(ctx.Tr("repo.mirror_interval_invalid"), tplSettingsOptions, &form)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user