Send pick-any checks with Other text; keep inbox focus across updates

This commit is contained in:
Ian Gulliver
2026-10-14 23:54:13 -07:00
parent 2b4d92e7d5
commit 75c76eff0a
11 changed files with 184 additions and 134 deletions
+2 -2
View File
@@ -167,8 +167,8 @@ func checkResponse(item api.InboxItem, c api.InboxResponseCreate) (api.InboxStat
}
seen[o] = true
}
if text != "" {
return bad("option takes no text; use other")
if text != "" && item.Payload["multiple"] != true {
return bad("a pick-one option takes no text; use other")
}
return api.Answered, nil
+1
View File
@@ -43,6 +43,7 @@ func TestCheckResponse(t *testing.T) {
{"two picks on pick-one", question, api.InboxResponseCreate{Type: api.Option, Options: opts("red", "blue")}, "", http.StatusBadRequest},
{"checked", checklist, api.InboxResponseCreate{Type: api.Option, Options: opts("tests", "lint")}, api.Answered, 0},
{"checked one", checklist, api.InboxResponseCreate{Type: api.Option, Options: opts("docs")}, api.Answered, 0},
{"checked with text", checklist, api.InboxResponseCreate{Type: api.Option, Options: opts("tests", "lint"), Text: str("also run go vet")}, api.Answered, 0},
{"checked twice", checklist, api.InboxResponseCreate{Type: api.Option, Options: opts("docs", "docs")}, "", http.StatusBadRequest},
{"checked unknown", checklist, api.InboxResponseCreate{Type: api.Option, Options: opts("docs", "deploy")}, "", http.StatusBadRequest},
{"other", question, api.InboxResponseCreate{Type: api.Other, Text: str("green")}, api.Answered, 0},