Toggle only a target's active state, so it cannot undo an edit (closes #431)
check / check (push) Successful in 3m27s

The target toggle loaded the target, flipped its active flag and saved the whole row, so an edit of the same target's name or settings saved in between was written back over and lost, although it reported success. The toggle now updates only the active column, so it can no longer undo an edit. A test saves an edit just after the toggle has read the target and shows the edit survives and the state flips. The entrypoint toggle is unchanged, since an entrypoint has no edit form.

Model: opus-5-5
This commit was merged in pull request #437.
This commit is contained in:
2026-10-02 14:43:00 +02:00
parent 0f9b68a0e8
commit d52cac1ec6
2 changed files with 72 additions and 2 deletions
+6 -2
View File
@@ -1911,9 +1911,13 @@ func (h *Handlers) HandleTargetToggle() http.HandlerFunc {
return false, err
}
tgt.Active = !tgt.Active
// Only the active column: saving the whole row would
// write back the name and settings read above over an
// edit saved since.
active := !tgt.Active
return tgt.Active, h.db.DB().Save(&tgt).Error
return active, h.db.DB().Model(&tgt).
Update("active", active).Error
},
"failed to toggle target",
targetActivated, targetDeactivated,