summaryrefslogtreecommitdiffstats
path: root/models/repo/pushmirror.go
diff options
context:
space:
mode:
authorpuni9869 <80308335+puni9869@users.noreply.github.com>2023-08-01 21:30:59 +0530
committerGitHub <noreply@github.com>2023-08-01 16:00:59 +0000
commitab388deb0e52c058a19dbd844bdd890f7cf84d51 (patch)
tree137df16493d51306d39e4b5d19a76620e2aaf4b4 /models/repo/pushmirror.go
parentab0e588217a0338e3dc83547be64febad733117f (diff)
downloadgitea-ab388deb0e52c058a19dbd844bdd890f7cf84d51.tar.gz
gitea-ab388deb0e52c058a19dbd844bdd890f7cf84d51.zip
Allow editing push mirrors after creation (#26151)
Allow users to edit the sync interval for existing push mirrors. Currently, there is no way to modify the interval once the mirror is created. <details> <summary>Screenshots</summary> ## Before <img width="936" alt="Screenshot 2023-07-26 at 9 31 21 AM" src="https://github.com/go-gitea/gitea/assets/80308335/35b8a40c-4320-474c-a866-1dea0f1fa0de"> ## After <img width="945" alt="Screenshot 2023-07-26 at 9 44 40 AM" src="https://github.com/go-gitea/gitea/assets/80308335/ee12e12f-0f68-4feb-90eb-33366f5997d3"> ### On hover <img width="247" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/2f32de45-bd50-4150-9623-3be2ef3ea7f8"> <img width="237" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/49f4ab4d-ccff-4489-80ce-a9788a73c3bb"> <img width="245" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/165fc888-9d48-438a-b730-d4beb12122af"> ### Edit modal <img width="905" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/2a7ca24b-4f36-4e0e-9799-39f2ecc46413"> ### Only valid times are allowed <img width="728" alt="Screenshot 2023-07-26 at 9 50 01 AM" src="https://github.com/go-gitea/gitea/assets/80308335/ced6d330-c235-4e29-8f17-28daddcf1444"> <img width="853" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/8636f62a-70d1-4684-a3e8-b205adc03580"> </details> Fixes #21295 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'models/repo/pushmirror.go')
-rw-r--r--models/repo/pushmirror.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/repo/pushmirror.go b/models/repo/pushmirror.go
index f34484f638..dad9a9d388 100644
--- a/models/repo/pushmirror.go
+++ b/models/repo/pushmirror.go
@@ -85,6 +85,12 @@ func UpdatePushMirror(ctx context.Context, m *PushMirror) error {
return err
}
+// UpdatePushMirrorInterval updates the push-mirror
+func UpdatePushMirrorInterval(ctx context.Context, m *PushMirror) error {
+ _, err := db.GetEngine(ctx).ID(m.ID).Cols("interval").Update(m)
+ return err
+}
+
func DeletePushMirrors(ctx context.Context, opts PushMirrorOptions) error {
if opts.RepoID > 0 {
_, err := db.GetEngine(ctx).Where(opts.toConds()).Delete(&PushMirror{})