Skip to content

Move IsTargeted property from Activity to Account#365

Merged
ShanmathiMayuramKrithivasan merged 5 commits intomicrosoft:mainfrom
ShanmathiMayuramKrithivasan:shmayura/targeted-messages-1.5
Mar 18, 2026
Merged

Move IsTargeted property from Activity to Account#365
ShanmathiMayuramKrithivasan merged 5 commits intomicrosoft:mainfrom
ShanmathiMayuramKrithivasan:shmayura/targeted-messages-1.5

Conversation

@ShanmathiMayuramKrithivasan
Copy link
Copy Markdown
Collaborator

  • Moved IsTargeted from Activity to Account and made it serializable, so it's present in the JSON payload as Recipient.IsTargeted.
  • Updated routing logic to read from Recipient.IsTargeted instead of Activity.IsTargeted

Copilot AI review requested due to automatic review settings March 10, 2026 11:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR relocates the “targeted activity” flag from Activity to Account so it can be serialized as recipient.isTargeted, and updates sending/routing behavior and tests accordingly.

Changes:

  • Removed Activity.IsTargeted and added nullable Account.IsTargeted with JSON serialization metadata.
  • Updated WithRecipient(...) and ASP.NET Core sender plugin logic to use Recipient.IsTargeted for targeted routing.
  • Updated/removed tests to validate the new property location and serialization behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Tests/Microsoft.Teams.Apps.Tests/AppTests.cs Updates targeted message assertions to use Recipient.IsTargeted and removes obsolete validation test.
Tests/Microsoft.Teams.Api.Tests/Activities/Message/MessageActivityTests.cs Updates fluent API and JSON serialization tests to assert recipient.isTargeted.
Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/AspNetCorePlugin.cs Switches targeted routing detection to activity.Recipient?.IsTargeted == true.
Libraries/Microsoft.Teams.Apps/App.cs Removes proactive-send validation that depended on Activity.IsTargeted.
Libraries/Microsoft.Teams.Api/Activities/Activity.cs Removes IsTargeted, updates WithRecipient, and removes targeted merge behavior.
Libraries/Microsoft.Teams.Api/Account.cs Adds IsTargeted as a serializable property on Account.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread Libraries/Microsoft.Teams.Api/Activities/Activity.cs
Comment thread Libraries/Microsoft.Teams.Api/Activities/Activity.cs
Comment thread Libraries/Microsoft.Teams.Api/Activities/Activity.cs
Copilot AI review requested due to automatic review settings March 18, 2026 06:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread Libraries/Microsoft.Teams.Api/Account.cs
Comment thread Libraries/Microsoft.Teams.Api/Activities/Activity.cs
Copilot AI review requested due to automatic review settings March 18, 2026 15:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

Libraries/Microsoft.Teams.Api/Activities/Activity.cs:434

  • Activity.Merge previously propagated the targeted flag; after moving it onto Recipient.IsTargeted, the merge no longer preserves that state when Recipient is already set. To maintain the old behavior (targeted wins), merge from.Recipient?.IsTargeted==true into the current Recipient (e.g., if Recipient is not null, set Recipient.IsTargeted = true when the source is targeted).
    public Activity Merge(Activity from)
    {
        Id ??= from.Id;
        ReplyToId ??= from.ReplyToId;
        ChannelId ??= from.ChannelId;
        From ??= from.From;
        Recipient ??= from.Recipient;
        Conversation ??= from.Conversation;
        RelatesTo ??= from.RelatesTo;
        ServiceUrl ??= from.ServiceUrl;
        Locale ??= from.Locale;
        Timestamp ??= from.Timestamp;
        LocalTimestamp ??= from.LocalTimestamp;
        AddEntity(from.Entities?.ToArray() ?? []);

        if (from.ChannelData is not null)
        {
            WithData(from.ChannelData);
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread Tests/Microsoft.Teams.Apps.Tests/AppTests.cs
@ShanmathiMayuramKrithivasan ShanmathiMayuramKrithivasan merged commit b04340f into microsoft:main Mar 18, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants