8000 port: Fix first activity from bot to user has fake replyToId value (#… · Attels/botbuilder-python@1099ffd · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 1099ffd

Browse files
authored
port: Fix first activity from bot to user has fake replyToId value (microsoft#2145)
* Fix first activity from bot to user has fake replyToId value * Removed duplicate activity_id
1 parent 9a70940 commit 1099ffd

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

libraries/botbuilder-core/botbuilder/core/adapters/test_adapter.py

Lines changed: 3 additions & 1 deletion
< 8000 td data-grid-cell-id="diff-418f3961d30d3d3b3121d23c2d112a34180c3c724d5872c002a114747a903189-147-149-2" data-line-anchor="diff-418f3961d30d3d3b3121d23c2d112a34180c3c724d5872c002a114747a903189R149" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);padding-right:24px" tabindex="-1" valign="top" class="focusable-grid-cell diff-text-cell right-side-diff-cell left-side">
activity.recipient = self.template.recipient
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ async def process_activity(
142142
if activity.type is None:
143143
activity.type = ActivityTypes.message
144144

145-
activity.channel_id = self.template.channel_id
145+
if activity.channel_id is None:
146+
activity.channel_id = self.template.channel_id
147+
146148
activity.from_property = self.template.from_property
147149
148150
activity.conversation = self.template.conversation

libraries/botbuilder-schema/botbuilder/schema/_models_py3.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,12 @@ def create_reply(self, text: str = None, locale: str = None):
639639
id=self.from_property.id if self.from_property else None,
640640
name=self.from_property.name if self.from_property else None,
641641
),
642-
reply_to_id=self.id,
642+
reply_to_id=(
643+
self.id
644+
if not type == ActivityTypes.conversation_update
645+
or self.channel_id not in ["directline", "webchat"]
646+
else None
647+
),
643648
service_url=self.service_url,
644649
channel_id=self.channel_id,
645650
conversation=ConversationAccount(
@@ -681,7 +686,12 @@ def create_trace(
681686
id=self.from_property.id if self.from_property else None,
682687
name=self.from_property.name if self.from_property else None,
683688
),
684-
reply_to_id=self.id,
689+
reply_to_id=(
690+
self.id
691+
if not type == ActivityTypes.conversation_update
692+
or self.channel_id not in ["directline", "webchat"]
693+
else None
694+
),
685695
service_url=self.service_url,
686696
channel_id=self.channel_id,
687697
conversation=ConversationAccount(
@@ -737,7 +747,12 @@ def get_conversation_reference(self):
737747
:returns: A conversation reference for the conversation that contains this activity.
738748
"""
739749
return ConversationReference(
740-
activity_id=self.id,
750+
activity_id=(
751+
self.id
752+
if not type == ActivityTypes.conversation_update
753+
or self.channel_id not in ["directline", "webchat"]
754+
else None
755+
),
741756
user=self.from_property,
742757
bot=self.recipient,
743758
conversation=self.conversation,

0 commit comments

Comments
 (0)
0