Default targeted replies for targeted inbound messages#592
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates ActivityContext.send()/reply() behavior so that when the inbound activity is a targeted message, outbound message sends default to targeted as well, while still allowing callers to explicitly send a non-targeted (public) message. It also adds Jest coverage for the new defaulting behavior and the explicit override path.
Changes:
- Default outbound
send()messages to targeted when the inbound activity is targeted (unless an explicit recipient is provided). - Update the targeted-reply test to assert the new default recipient targeting behavior.
- Add tests covering the new default-targeted behavior and the explicit “public send” override.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/apps/src/contexts/activity.ts | Adjusts send() to default outbound messages to targeted when the inbound activity is targeted. |
| packages/apps/src/contexts/activity.test.ts | Adds/updates tests to cover the new defaulting behavior and override case. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| await send( | ||
| new MessageActivity('🌍 This is a **public message** — everyone can see this!') | ||
| .withRecipient(activity.from) | ||
| ); |
There was a problem hiding this comment.
Could we get further documentation underlining that for auto-targeting, caller must pass any recipient to work? (Maybe you had planned this already)
There was a problem hiding this comment.
(Inline comment indicating recipient = user here would also be good, I think)
There was a problem hiding this comment.
actually the intent here is that the default behavior is to auto-target. But you bring up a really good point that if recipient that is not the user is set, then we shouldn't auto-target
Summary
send/replydefault to targeted when replying to a targeted inbound messagetargetedMessageInfolimited to targeted inbound replies, so normal explicit targeted sends still worksend privateandsend publicNote: this also cleans up a pre-existing dead branch from when
isTargetedmoved ontorecipient—params.recipient?.isTargetedalready meansparams.recipientexists.Test plan
cd packages/apps && npx jest src/contexts/activity.test.ts --runInBandcd packages/apps && npm run buildcd examples/targeted-messages && npm run build