Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 2edbf3c

Browse files
authored
BotFrameworkAdapter.createConversation could overwrite ChannelData (#1264)
1 parent 1961cca commit 2edbf3c

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,7 @@ public CompletableFuture<Void> createConversation(
10961096
* @return A task that represents the work queued to execute.
10971097
*/
10981098
@SuppressWarnings("checkstyle:InnerAssignment")
1099+
@Deprecated
10991100
public CompletableFuture<Void> createConversation(
11001101
String channelId,
11011102
String serviceUrl,
@@ -1112,13 +1113,21 @@ public CompletableFuture<Void> createConversation(
11121113
if (!StringUtils.isEmpty(tenantId)) {
11131114
// Putting tenantId in channelData is a temporary solution while we wait for the
11141115
// Teams API to be updated
1115-
ObjectNode channelData = JsonNodeFactory.instance.objectNode();
1116-
channelData.set(
1117-
"tenant",
1118-
JsonNodeFactory.instance.objectNode().set("tenantId", JsonNodeFactory.instance.textNode(tenantId))
1119-
);
1116+
if (conversationParameters.getChannelData() != null) {
1117+
((ObjectNode) conversationParameters.getChannelData()).set(
1118+
"tenantId",
1119+
JsonNodeFactory.instance.textNode(tenantId)
1120+
);
1121+
} else {
1122+
ObjectNode channelData = JsonNodeFactory.instance.objectNode();
1123+
channelData.set(
1124+
"tenant",
1125+
JsonNodeFactory.instance.objectNode()
1126+
.set("tenantId", JsonNodeFactory.instance.textNode(tenantId))
1127+
);
11201128

1121-
conversationParameters.setChannelData(channelData);
1129+
conversationParameters.setChannelData(channelData);
1130+
}
11221131

11231132
conversationParameters.setTenantId(tenantId);
11241133
}

0 commit comments

Comments
 (0)