Send pick-any checks with Other text; keep inbox focus across updates
This commit is contained in:
@@ -372,6 +372,9 @@ func deliveryMessage(pending []store.Pending) string {
|
||||
for _, o := range *r.Options {
|
||||
fmt.Fprintf(b, "- %s\n", o)
|
||||
}
|
||||
if r.Text != nil && strings.TrimSpace(*r.Text) != "" {
|
||||
fmt.Fprintf(b, "%s added: %s\n", r.User, *r.Text)
|
||||
}
|
||||
} else {
|
||||
fmt.Fprintf(b, "%s chose: %s\n", r.User, (*r.Options)[0])
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ func TestDeliveryMessage(t *testing.T) {
|
||||
|
||||
msg := deliveryMessage([]store.Pending{
|
||||
{Item: question, Response: api.InboxResponse{User: "alice", Type: api.Option, Options: opts("blue")}},
|
||||
{Item: checklist, Response: api.InboxResponse{User: "alice", Type: api.Option, Options: opts("tests", "docs")}},
|
||||
{Item: checklist, Response: api.InboxResponse{User: "alice", Type: api.Option, Options: opts("tests", "docs"), Text: str("also run go vet")}},
|
||||
{Item: question, Response: api.InboxResponse{User: "bob", Type: api.Other, Text: str("what is it for?"),
|
||||
Attachments: []api.Attachment{{Kind: api.AttachmentKindUrl, Url: str("https://example.com")}}}},
|
||||
{Item: failure, Response: api.InboxResponse{User: "alice", Type: api.Other, Text: str("stop and write tests")}},
|
||||
@@ -228,7 +228,7 @@ func TestDeliveryMessage(t *testing.T) {
|
||||
for _, want := range []string{
|
||||
"Your question q1: Which color?",
|
||||
"alice chose: blue",
|
||||
"Your question q2: Which chores?\nalice checked:\n- tests\n- docs\n",
|
||||
"Your question q2: Which chores?\nalice checked:\n- tests\n- docs\nalice added: also run go vet\n",
|
||||
"bob answered (none of your options): what is it for?",
|
||||
`calling ask_human with thread_id "q1"`,
|
||||
`"url":"https://example.com"`,
|
||||
|
||||
Reference in New Issue
Block a user