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

Change OAuthPrompt to default to AcceptingInput instead of ExpectingInput #1043

Merged
merged 3 commits into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions libraries/botbuilder-azure/package.json.lerna_backup

This file was deleted.

6 changes: 4 additions & 2 deletions libraries/botbuilder-core/src/turnContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ export class TurnContext {

/**
* Rewrites the activity text without any at mention.
* Use with caution because this function is altering the text on the Activity.
*
* @remarks
* Some channels, for example Microsoft Teams, add at mention details into the text on a message activity.
* This can interfer with later procsesing. This is a helper function to remove the at mention.
* This can interfere with later processing. This is a helper function to remove the at mention.
*
* ```JavaScript
* const updatedText = TurnContext.removeRecipientMention(context.request);
Expand All @@ -97,10 +98,11 @@ export class TurnContext {

/**
* Rewrites the activity text without any at mention. Specifying a particular recipient id.
* Use with caution because this function is altering the text on the Activity.
*
* @remarks
* Some channels, for example Microsoft Teams, add at mention details into the text on a message activity.
* This can interfer with later procsesing. This is a helper function to remove the at mention.
* This can interfer with later processing. This is a helper function to remove the at mention.
*
* ```JavaScript
* const updatedText = TurnContext.removeRecipientMention(context.request);
Expand Down
6 changes: 3 additions & 3 deletions libraries/botbuilder-dialogs/src/prompts/oauthPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ export class OAuthPrompt extends Dialog {
// Ensure prompts have input hint set
const o: Partial<PromptOptions> = {...options};
if (o.prompt && typeof o.prompt === 'object' && typeof o.prompt.inputHint !== 'string') {
o.prompt.inputHint = InputHints.ExpectingInput;
o.prompt.inputHint = InputHints.AcceptingInput;
}
if (o.retryPrompt && typeof o.retryPrompt === 'object' && typeof o.retryPrompt.inputHint !== 'string') {
o.retryPrompt.inputHint = InputHints.ExpectingInput;
o.retryPrompt.inputHint = InputHints.AcceptingInput;
}

// Initialize prompt state
Expand Down Expand Up @@ -242,7 +242,7 @@ export class OAuthPrompt extends Dialog {

// Initialize outgoing message
const msg: Partial<Activity> =
typeof prompt === 'object' ? {...prompt} : MessageFactory.text(prompt, undefined, InputHints.ExpectingInput);
typeof prompt === 'object' ? {...prompt} : MessageFactory.text(prompt, undefined, InputHints.AcceptingInput);
if (!Array.isArray(msg.attachments)) { msg.attachments = []; }

// Add login card as needed
Expand Down
3 changes: 2 additions & 1 deletion libraries/botbuilder-dialogs/tests/oauthPrompt.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { ActivityTypes, ConversationState, MemoryStorage, TestAdapter, CardFactory } = require('botbuilder-core');
const { ActivityTypes, CardFactory, ConversationState, InputHints, MemoryStorage, TestAdapter } = require('botbuilder-core');
const { OAuthPrompt, OAuthPromptSettings, DialogSet, DialogTurnStatus, ListStyle } = require('../');
const assert = require('assert');

Expand Down Expand Up @@ -47,6 +47,7 @@ describe('OAuthPrompt', function () {
.assertReply(activity => {
assert(activity.attachments.length === 1);
assert(activity.attachments[0].contentType === CardFactory.contentTypes.oauthCard);
assert(activity.inputHint === InputHints.AcceptingInput);

// send a mock EventActivity back to the bot with the token
adapter.addUserToken(connectionName, activity.channelId, activity.recipient.id, token);
Expand Down