Skip to content

Commit

Permalink
port: Fix first activity from bot to user has fake replyToId value (#…
Browse files Browse the repository at this point in the history
…2145)

* Fix first activity from bot to user has fake replyToId value

* Removed duplicate activity_id
  • Loading branch information
gandiddi authored Aug 5, 2024
1 parent 9a70940 commit 1099ffd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ async def process_activity(
if activity.type is None:
activity.type = ActivityTypes.message

activity.channel_id = self.template.channel_id
if activity.channel_id is None:
activity.channel_id = self.template.channel_id

activity.from_property = self.template.from_property
activity.recipient = self.template.recipient
activity.conversation = self.template.conversation
Expand Down
21 changes: 18 additions & 3 deletions libraries/botbuilder-schema/botbuilder/schema/_models_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,12 @@ def create_reply(self, text: str = None, locale: str = None):
id=self.from_property.id if self.from_property else None,
name=self.from_property.name if self.from_property else None,
),
reply_to_id=self.id,
reply_to_id=(
self.id
if not type == ActivityTypes.conversation_update
or self.channel_id not in ["directline", "webchat"]
else None
),
service_url=self.service_url,
channel_id=self.channel_id,
conversation=ConversationAccount(
Expand Down Expand Up @@ -681,7 +686,12 @@ def create_trace(
id=self.from_property.id if self.from_property else None,
name=self.from_property.name if self.from_property else None,
),
reply_to_id=self.id,
reply_to_id=(
self.id
if not type == ActivityTypes.conversation_update
or self.channel_id not in ["directline", "webchat"]
else None
),
service_url=self.service_url,
channel_id=self.channel_id,
conversation=ConversationAccount(
Expand Down Expand Up @@ -737,7 +747,12 @@ def get_conversation_reference(self):
:returns: A conversation reference for the conversation that contains this activity.
"""
return ConversationReference(
activity_id=self.id,
activity_id=(
self.id
if not type == ActivityTypes.conversation_update
or self.channel_id not in ["directline", "webchat"]
else None
),
user=self.from_property,
bot=self.recipient,
conversation=self.conversation,
Expand Down

0 comments on commit 1099ffd

Please sign in to comment.