Questions tab, question bubbles, answer snapshots; errors to transcript

This commit is contained in:
Ian Gulliver
2026-10-18 15:06:06 -07:00
parent 1ef3594016
commit 10a80ccb22
31 changed files with 744 additions and 665 deletions
-13
View File
@@ -108,16 +108,12 @@ func CheckResponse(item api.InboxItem, c api.InboxResponseCreate) (api.InboxStat
text = strings.TrimSpace(*c.Text)
}
images := c.Images != nil && len(*c.Images) > 0
question := item.Kind == api.Question
bad := func(format string, args ...any) (api.InboxState, error) {
return "", fmt.Errorf("%w: item %s: "+format, append([]any{ErrInvalid, item.Id}, args...)...)
}
switch c.Type {
case api.Option:
if !question {
return bad("only questions have options")
}
if c.Options == nil || len(*c.Options) == 0 {
return bad("option needs the chosen options")
}
@@ -144,15 +140,6 @@ func CheckResponse(item api.InboxItem, c api.InboxResponseCreate) (api.InboxStat
return bad("other needs text or images")
}
return api.Answered, nil
case api.Dismiss:
if question {
return bad("questions need an option or other, not a dismissal")
}
if images {
return bad("a dismissal takes no images")
}
return api.Dismissed, nil
}
return bad("unknown response type %q", c.Type)