Skip to content

Commit

Permalink
Update teamsNotifyUser to receive Partial Activity (#4166)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Dahlvang <erdahlva@microsoft.com>
  • Loading branch information
ceciliaavila and EricDahlvang authored Mar 23, 2022
1 parent d28d61f commit aaf2c96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libraries/botbuilder/etc/botbuilder.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ export class TeamsInfo {
}

// @public
export function teamsNotifyUser(activity: Activity, alertInMeeting?: boolean, externalResourceUrl?: string): void;
export function teamsNotifyUser(activity: Partial<Activity>, alertInMeeting?: boolean, externalResourceUrl?: string): void;

// @public
export class TeamsSSOTokenExchangeMiddleware implements Middleware {
Expand Down
8 changes: 6 additions & 2 deletions libraries/botbuilder/src/teamsActivityHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function isTeamsChannelData(channelData: unknown): channelData is TeamsChannelDa
return typeof channelData === 'object';
}

function validateActivity(activity: Activity): void {
function validateActivity(activity: Partial<Activity>): void {
if (!activity) {
throw new Error('Missing activity parameter');
}
Expand Down Expand Up @@ -104,7 +104,11 @@ export function teamsGetChannelId(activity: Activity): string | null {
* @param alertInMeeting Sent to a meeting chat, this will cause the Teams client to render it in a notification popup as well as in the chat thread.
* @param externalResourceUrl Url to external resource. Must be included in manifest's valid domains.
*/
export function teamsNotifyUser(activity: Activity, alertInMeeting = false, externalResourceUrl?: string): void {
export function teamsNotifyUser(
activity: Partial<Activity>,
alertInMeeting: boolean = false,
externalResourceUrl?: string
): void {
validateActivity(activity);

if (!isTeamsChannelData(activity.channelData)) {
Expand Down

0 comments on commit aaf2c96

Please sign in to comment.