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 ShowTypingMiddleware #507

Merged
merged 6 commits into from
Oct 10, 2018
Merged

Add ShowTypingMiddleware #507

merged 6 commits into from
Oct 10, 2018

Conversation

benbrown
Copy link
Contributor

@benbrown benbrown commented Oct 2, 2018

This adds a ShowTypingMiddleware to botbuilder-core, as well as some unit tests.

This is basically a port of the dotnet version, with some slight changes for Javascript.

Should address #470.

@coveralls
Copy link

coveralls commented Oct 2, 2018

Pull Request Test Coverage Report for Build 1761

  • 23 of 29 (79.31%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 72.467%

Changes Missing Coverage Covered Lines Changed/Added Lines %
libraries/botbuilder-core/src/showTypingMiddleware.ts 22 28 78.57%
Totals Coverage Status
Change from base Build 1759: 0.006%
Covered Lines: 2295
Relevant Lines: 3047

💛 - Coveralls

if (context.activity.type === ActivityTypes.Message) {
// Set a property to track whether or not the turn is finished.
// When it flips to true, we won't send anymore typing indicators.
this.finished = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

this.finished = false; [](start = 16, length = 22)

What if you have a hundred simultaneous requests? If anything you should store this flag in TurnContext.turnState. You can use a Symbol() for the key to avoid name collisions. Take a look at BotState for an example of that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah whoops!
I've updated this to be a local variable which should resolve the rush condition/state issues.

@benbrown
Copy link
Contributor Author

benbrown commented Oct 9, 2018

Any more feedback on this, @Stevenic?

Copy link
Contributor

@Stevenic Stevenic left a comment

Choose a reason for hiding this comment

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

:shipit:

@Stevenic Stevenic merged commit 0313ec3 into master Oct 10, 2018
@Stevenic Stevenic deleted the benbrown/showtypingmiddleware branch October 10, 2018 19:24
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.

4 participants