Mark the lead's messages and answers as the lead's, not the human's

This commit is contained in:
Ian Gulliver
2026-10-20 12:20:51 -07:00
parent 181482e5d0
commit 0f33ad4524
14 changed files with 93 additions and 23 deletions
+6 -5
View File
@@ -531,6 +531,7 @@ func deliveryMessage(pending []store.Pending) string {
b := &strings.Builder{}
for i, p := range pending {
r := p.Response
who := actorName(r.User)
if i > 0 {
b.WriteString("\n")
}
@@ -540,27 +541,27 @@ func deliveryMessage(pending []store.Pending) string {
switch r.Type {
case api.Option:
if p.Item.Payload["multiple"] == true {
fmt.Fprintf(b, "%s checked:\n", r.User)
fmt.Fprintf(b, "%s checked:\n", who)
for _, o := range *r.Options {
fmt.Fprintf(b, "- %s\n", o)
}
} else {
fmt.Fprintf(b, "%s chose: %s\n", r.User, (*r.Options)[0])
fmt.Fprintf(b, "%s chose: %s\n", who, (*r.Options)[0])
}
if r.Text != nil && strings.TrimSpace(*r.Text) != "" {
fmt.Fprintf(b, "%s added: %s\n", r.User, *r.Text)
fmt.Fprintf(b, "%s added: %s\n", who, *r.Text)
}
case api.Other:
text := ""
if r.Text != nil {
text = *r.Text
}
fmt.Fprintf(b, "%s answered (none of your options): %s\n", r.User, text)
fmt.Fprintf(b, "%s answered (none of your options): %s\n", who, text)
fmt.Fprintf(b, "If this asks you something back, answer by calling ask_human with thread_id %q.\n", p.Item.ThreadId)
}
if len(r.Images) > 0 {
fmt.Fprintf(b, "%s attached %d image(s) to this response; they come with this message.\n", r.User, len(r.Images))
fmt.Fprintf(b, "%s attached %d image(s) to this response; they come with this message.\n", who, len(r.Images))
}
for _, a := range r.Attachments {