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

BotFrameworkAdapter.createConversation could overwrite ChannelData #1264

Merged
merged 2 commits into from
Jun 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ public CompletableFuture<Void> createConversation(
* @return A task that represents the work queued to execute.
*/
@SuppressWarnings("checkstyle:InnerAssignment")
@Deprecated
public CompletableFuture<Void> createConversation(
String channelId,
String serviceUrl,
Expand All @@ -1112,13 +1113,21 @@ public CompletableFuture<Void> createConversation(
if (!StringUtils.isEmpty(tenantId)) {
// Putting tenantId in channelData is a temporary solution while we wait for the
// Teams API to be updated
ObjectNode channelData = JsonNodeFactory.instance.objectNode();
channelData.set(
"tenant",
JsonNodeFactory.instance.objectNode().set("tenantId", JsonNodeFactory.instance.textNode(tenantId))
);
if (conversationParameters.getChannelData() != null) {
((ObjectNode) conversationParameters.getChannelData()).set(
"tenantId",
JsonNodeFactory.instance.textNode(tenantId)
);
} else {
ObjectNode channelData = JsonNodeFactory.instance.objectNode();
channelData.set(
"tenant",
JsonNodeFactory.instance.objectNode()
.set("tenantId", JsonNodeFactory.instance.textNode(tenantId))
);

conversationParameters.setChannelData(channelData);
conversationParameters.setChannelData(channelData);
}

conversationParameters.setTenantId(tenantId);
}
Expand Down