Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add locale support in DirectLine options #293

Merged
merged 8 commits into from Aug 5, 2020

Conversation

timenick
Copy link
Contributor

fixes #292

@timenick timenick changed the title Add locale userid and userid, username support Add locale userid and username support Jul 10, 2020
@timenick timenick requested a review from youyu16 July 10, 2020 09:39
@timenick timenick changed the title Add locale userid and username support Add locale support in DirectLine options Jul 13, 2020
@timenick timenick marked this pull request as ready for review July 15, 2020 03:06
@cwhitten
Copy link
Member

@timenick I’ll look into this tomorrow, but we likely need changes in the Emulator as well

@timenick timenick requested a review from cwhitten July 21, 2020 03:12
Copy link
Collaborator

@compulim compulim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests: 1 happy path, 1+ unhappy paths.

src/directLine.ts Outdated Show resolved Hide resolved
src/directLine.ts Outdated Show resolved Hide resolved
src/directLine.ts Outdated Show resolved Hide resolved
src/directLine.ts Outdated Show resolved Hide resolved
src/directLine.ts Outdated Show resolved Hide resolved
@compulim
Copy link
Collaborator

After talking to @timenick, because the service change is not on production yet, thus, he cannot add any tests yet.

He will test it manually, then add tests in another PR.

@cwhitten
Copy link
Member

After talking to @timenick, because the service change is not on production yet, thus, he cannot add any tests yet.

He will test it manually, then add tests in another PR.

@timenick now that the changes are in production, can you add the tests William is asking for?

const body = this.conversationId
? undefined
: {
locale: this.localeOnStartConversation

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if conversationStartProperties is not sent in or does not contain a locale, should we still send a body? I would assume not since we dont want to change any existing client.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our backend, we are reading from body to get the conversationStartParameters. Because we are not only sending locale in body, we would send more parameters (like userid, username, etc) in the future. The locale parameter is optional, it would not affect any existing client.

timeout: this.timeout,
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
Copy link

@p-nagpal p-nagpal Jul 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test to make sure adding a Content-Type doesnt affect existing clients that dont send a body.

Copy link

@p-nagpal p-nagpal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add tests

  1. DirectLineJS does not receive conversation start parameters (tests that existing clients are not affected)
  2. DirectLineJS does not receive a locale in the conversation start parameters
  3. DirectLineJS receives a valid locale in the conversation start parameters
  4. DirectLineJS receives a invalid locale in the conversation start parameters

@timenick
Copy link
Contributor Author

After talking to @timenick, because the service change is not on production yet, thus, he cannot add any tests yet.
He will test it manually, then add tests in another PR.

@timenick now that the changes are in production, can you add the tests William is asking for?

Sure. I will update the test bot first. And will sync with William for the tests.

@@ -479,6 +482,12 @@ export class DirectLine implements IBotConnection {
this.token = options.secret || options.token;
this.webSocket = (options.webSocket === undefined ? true : options.webSocket) && typeof WebSocket !== 'undefined' && WebSocket !== undefined;

if (options.conversationStartProperties) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (options.conversationStartProperties) {
if (options.conversationStartProperties && options.conversationStartProperties.locale) {

Combine two ifs into one.

src/directLine.ts Outdated Show resolved Hide resolved
@compulim compulim merged commit 8df1caa into master Aug 5, 2020
@compulim compulim deleted the zhiwang/add_locale_and_userid_username_options branch August 7, 2020 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support locale at StartConversation
4 participants