Skip to content

Commit

Permalink
Merge 4433bb9 into 0fd343a
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyanziano committed Feb 22, 2019
2 parents 0fd343a + 4433bb9 commit a8a0a10
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## v4.3.0 - 2019 - 03 - 04
### Added
- [docs] Added changelog in PR [#1230](https://github.com/Microsoft/BotFramework-Emulator/pull/1230)
- [style] 💅 Integrated prettier and eslint in PR [#1240](https://github.com/Microsoft/BotFramework-Emulator/pull/1240)
Expand All @@ -21,3 +23,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [client] Fixed issue where transcript tab name was being overwritten after opening the transcript a second time, in PR [#1304](https://github.com/Microsoft/BotFramework-Emulator/pull/1304)
- [client] Fixed issue where links pointing to data urls were opening the Windows store, in PR [#1315](https://github.com/Microsoft/BotFramework-Emulator/pull/1315)
- [client] Fixed Azure gov checkbox and added a link to docs, in PR [#1292](https://github.com/Microsoft/BotFramework-Emulator/pull/1292)
- [client] Fixed issue where restart conversation was not clearing history, in PR [#1325](https://github.com/Microsoft/BotFramework-Emulator/pull/1325)
27 changes: 20 additions & 7 deletions packages/app/client/src/ui/editor/emulator/emulator.tsx
Expand Up @@ -147,7 +147,11 @@ export class EmulatorComponent extends React.Component<EmulatorProps, {}> {
}
}

startNewConversation = async (props: EmulatorProps = this.props): Promise<any> => {
startNewConversation = async (
props: EmulatorProps = this.props,
requireNewConvoId: boolean = false,
requireNewUserId: boolean = false
): Promise<any> => {
if (props.document.subscription) {
props.document.subscription.unsubscribe();
}
Expand All @@ -160,11 +164,20 @@ export class EmulatorComponent extends React.Component<EmulatorProps, {}> {

// Look for an existing conversation ID and use that,
// otherwise, create a new one
const conversationId = props.document.conversationId || `${uniqueId()}|${props.mode}`;
const conversationId = requireNewConvoId
? `${uniqueId()}|${props.mode}`
: props.document.conversationId || `${uniqueId()}|${props.mode}`;

const userId = requireNewUserId ? uniqueIdv4() : props.document.userId;
if (requireNewUserId) {
await CommandServiceImpl.remoteCall(SharedConstants.Commands.Emulator.SetCurrentUser, userId);
}

const options = {
conversationId,
conversationMode: props.mode,
endpointId: props.endpointId,
userId,
};

if (props.document.directLine) {
Expand Down Expand Up @@ -238,6 +251,7 @@ export class EmulatorComponent extends React.Component<EmulatorProps, {}> {
directLine,
selectedActivity$,
subscription,
userId: options.userId,
});
}

Expand Down Expand Up @@ -360,18 +374,17 @@ export class EmulatorComponent extends React.Component<EmulatorProps, {}> {
this.props.trackEvent('conversation_restart', {
userId: 'new',
});
const newUserId = uniqueIdv4();
// set new user as current on emulator facilities side
await CommandServiceImpl.remoteCall(SharedConstants.Commands.Emulator.SetCurrentUser, newUserId);
this.props.updateChat(this.props.documentId, { userId: newUserId });
// start conversation with new convo id & user id
this.startNewConversation(undefined, true, true);
break;
}

case SameUserId:
this.props.trackEvent('conversation_restart', {
userId: 'same',
});
this.startNewConversation();
// start conversation with new convo id
this.startNewConversation(undefined, true, false);
break;

default:
Expand Down

0 comments on commit a8a0a10

Please sign in to comment.