Toggle only a target's active state, so it cannot undo an edit (closes #431)
check / check (push) Successful in 3m26s
check / check (push) Successful in 3m26s
The target toggle loaded the target and saved the whole row, so an edit saved between that load and the save was overwritten with the old name and settings although it had reported success. The toggle now updates only the active column. The entrypoint toggle is unchanged: an entrypoint has no edit form, so the toggle is the only thing that changes one after creation. Model: opus-5-5
This commit is contained in:
@@ -1814,9 +1814,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,
|
||||
|
||||
Reference in New Issue
Block a user