Skip to content

Commit

Permalink
Merge fba49db into 9c0d5bc
Browse files Browse the repository at this point in the history
  • Loading branch information
Corina committed Dec 6, 2018
2 parents 9c0d5bc + fba49db commit d6b972a
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 45 deletions.
61 changes: 40 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/app/client/package.json
Expand Up @@ -96,7 +96,7 @@
"@uifabric/styling": "^5.20.0",
"base64url": "2.0.0",
"botframework-config": "4.0.0-preview1.3.4",
"botframework-webchat": "0.14.3-master.b0553fd",
"botframework-webchat": "0.15.1-v3.4da20d6",
"react": "~16.3.2",
"react-dom": "~16.3.2",
"react-redux": "^5.0.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/client/src/ui/shell/mdi/tabBar/tabBar.tsx
Expand Up @@ -162,7 +162,7 @@ export class TabBar extends React.Component<TabBarProps, TabBarState> {

private get tabs(): JSX.Element[] {
return this.props.tabOrder.map((documentId, index) => {
const document = this.props.documents[documentId];
const document = this.props.documents[documentId] || {};
const isActive = documentId === this.props.activeDocumentId;

return (
Expand Down
33 changes: 23 additions & 10 deletions packages/app/main/src/utils/conversation.ts
Expand Up @@ -20,17 +20,30 @@ export function cleanupId(
) {
const roleIdMap = { bot: botId, user: userId };

activities = activities.map(activity => ({
...activity,
from: {
...activity.from,
id: roleIdMap[activity.from.role] || activity.from.id
},
recipient: {
...activity.recipient,
id: roleIdMap[activity.recipient.role] || activity.recipient.id
activities = activities.map((activity: any) => {
const { type } = activity;

if (
type === 'event'
|| type === 'message'
|| type === 'messageReaction'
|| type === 'typing'
) {
activity = {
...activity,
from: {
...activity.from,
id: roleIdMap[activity.from.role] || activity.from.id
},
recipient: {
...activity.recipient,
id: roleIdMap[activity.recipient.role] || activity.recipient.id
}
};
}
}));

return activity;
});

return activities;
}
Expand Down
36 changes: 24 additions & 12 deletions packages/emulator/core/src/facility/conversation.ts
Expand Up @@ -555,20 +555,32 @@ export default class Conversation extends EventEmitter {
const { id: currUserId } = this.user;
let origUserId = null;
let origBotId = null;

// Get original botId and userId
// Fixup conversationId
activities.forEach(activity => {
if (!origBotId && activity.recipient.role === 'bot') {
origBotId = activity.recipient.id;
}

if (!origUserId && activity.recipient.role === 'user') {
origUserId = activity.recipient.id;
}

activities.forEach( (activity) => {
if (activity.conversation) {
activity.conversation.id = this.conversationId;
}

const { type } = activity;

if (
activity.recipient && (
type === 'event'
|| type === 'message'
|| type === 'messageReaction'
|| type === 'typing'
)
) {
if (!origBotId && activity.recipient.role === 'bot') {
origBotId = activity.recipient.id;
}

if (!origUserId && activity.recipient.role === 'user') {
origUserId = activity.recipient.id;
}
}
});

// Fixup recipient and from ids
Expand All @@ -594,10 +606,10 @@ export default class Conversation extends EventEmitter {

// Add activities to the queue
activities.forEach(activity => {
if (activity.recipient.role === 'user') {
if (activity.recipient && activity.recipient.role === 'user') {
activity = this.processActivity(activity);
}

this.addActivityToQueue(activity);
});
}
Expand Down Expand Up @@ -680,7 +692,7 @@ export default class Conversation extends EventEmitter {

const genericActivity = activity as GenericActivity;

if (genericActivity) {
if (genericActivity && activity.recipient) {
this.botEmulator.facilities.logger.logActivity(this.conversationId, genericActivity, activity.recipient.role);
}
}
Expand Down

0 comments on commit d6b972a

Please sign in to comment.