fix(ui): approval centre and policy form called unwired callbacks
Neither noemad nor the test harness passed ui.Actions.Policy or Decide, so an operator's Approve, Deny and "add rule" forms dereferenced a nil function and returned 500. Both handlers now use the shared, audited server methods like the other study pages, and the unused callbacks are removed. The observer-escalation test only reached the role check, which is why this went unnoticed; the new browser test fails without the fix (policy form → 500) and passes with it.
This commit is contained in:
@@ -62,7 +62,7 @@ func (u *UI) policyCreate(w http.ResponseWriter, r *http.Request) {
|
||||
p.HoursFrom, p.HoursTo = &hf, &ht
|
||||
}
|
||||
}
|
||||
if _, err := u.policyF(r, p); err != nil {
|
||||
if _, err := u.studyF().CreatePolicy(r, p); err != nil {
|
||||
u.flash(w, r, "error", err.Error(), "/policies")
|
||||
return
|
||||
}
|
||||
@@ -126,7 +126,7 @@ func (u *UI) approvalDecide(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
decision := r.PostFormValue("decision")
|
||||
if _, err := u.decideF(r, id, decision, r.PostFormValue("note"), params); err != nil {
|
||||
if _, err := u.studyF().Decide(r, id, decision, r.PostFormValue("note"), params); err != nil {
|
||||
u.flash(w, r, "error", err.Error(), "/approvals")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user