@microsoft/teamsfx 1.2.1-rc.0 → 1.2.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2441,8 +2441,17 @@ function getTargetType(conversationReference) {
2441
2441
  * @internal
2442
2442
  */
2443
2443
  function getTeamsBotInstallationId(context) {
2444
- var _a, _b, _c, _d;
2445
- return (_d = (_c = (_b = (_a = context.activity) === null || _a === void 0 ? void 0 : _a.channelData) === null || _b === void 0 ? void 0 : _b.team) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : context.activity.conversation.id;
2444
+ var _a, _b, _c;
2445
+ const teamId = (_c = (_b = (_a = context.activity) === null || _a === void 0 ? void 0 : _a.channelData) === null || _b === void 0 ? void 0 : _b.team) === null || _c === void 0 ? void 0 : _c.id;
2446
+ if (teamId) {
2447
+ return teamId;
2448
+ }
2449
+ // Fallback to use conversation id.
2450
+ // the conversation id is equal to team id only when the bot app is installed into the General channel.
2451
+ if (context.activity.conversation.name === undefined) {
2452
+ return context.activity.conversation.id;
2453
+ }
2454
+ return undefined;
2446
2455
  }
2447
2456
 
2448
2457
  // Copyright (c) Microsoft Corporation.
@@ -3137,6 +3146,7 @@ class NotificationBot {
3137
3146
  }
3138
3147
  /**
3139
3148
  * Returns the first {@link Channel} where predicate is true, and undefined otherwise.
3149
+ * (Ensure the bot app is installed into the `General` channel, otherwise undefined will be returned.)
3140
3150
  *
3141
3151
  * @param predicate find calls predicate once for each channel of the installation,
3142
3152
  * until it finds one where predicate returns true. If such a channel is found, find
@@ -3183,6 +3193,7 @@ class NotificationBot {
3183
3193
  }
3184
3194
  /**
3185
3195
  * Returns all {@link Channel} where predicate is true, and empty array otherwise.
3196
+ * (Ensure the bot app is installed into the `General` channel, otherwise empty array will be returned.)
3186
3197
  *
3187
3198
  * @param predicate find calls predicate for each channel of the installation.
3188
3199
  * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.