in packages/app/client/src/utils/restartConversationQueue.ts [161:197]
public handleIncomingActivity(activity: Activity) {
if (this.isReplayComplete) {
return;
}
try {
const indexToBeInserted: number = this.receivedActivities.length;
if (
this.proactiveResponseValidationMap.has(indexToBeInserted) &&
this.proactiveResponseValidationMap.get(indexToBeInserted) !== activity.replyToId
) {
throw new Error('Replayed activities not in order of original conversation');
} else {
this.proactiveResponseValidationMap.delete(indexToBeInserted);
}
this.receivedActivities.push(activity);
if (activity.channelData && !activity.replyToId) {
const matchIndexes: number[] = activity.channelData.matchIndexes;
if (matchIndexes) {
matchIndexes.forEach((index: number) => {
if (!this.receivedActivities[index]) {
this.proactiveResponseValidationMap.set(index, activity.id);
} else if (this.receivedActivities[index].replyToId !== activity.id) {
throw new Error('Replayed activities not in order of original conversation');
}
});
}
}
if (this.userActivities.length === 0) {
this.isReplayComplete = true;
}
this.checkIfActivityToBePosted();
} catch (ex) {
return ex;
}
}