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 Bot State API deprecation warning #348

Merged
merged 16 commits into from
Nov 30, 2017
10 changes: 6 additions & 4 deletions src/server/controllers/connector/botStateController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ export class BotStateController {

private logBotStateApiDeprecationWarning(botId: string, conversationId: string) {
const conversation: Conversation = emulator.conversations.conversationById(botId, conversationId);
if (!conversation.stateApiDeprecationWarningShown) {
conversation.stateApiDeprecationWarningShown = true;
log.warn('Warning: The Bot Framework State API is not recommended for production environments, and may be deprecated in a future release.',
log.makeLinkMessage('Learn how to implement your own storage adapter.', 'https://aka.ms/botframework-state-service'));
if (conversation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please simplify this to a single line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@stevengum stevengum Nov 30, 2017

Choose a reason for hiding this comment

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

Since there aren't any else statements in this method, what about:

if (conversation && !conversation.stateApiDeprecationWarningShown) { 

as opposed to

if (conversation) { if (!conversation.stateApiDeprecationWarningShown) {

if (!conversation.stateApiDeprecationWarningShown) {
conversation.stateApiDeprecationWarningShown = true;
log.warn('Warning: The Bot Framework State API is not recommended for production environments, and may be deprecated in a future release.',
log.makeLinkMessage('Learn how to implement your own storage adapter.', 'https://aka.ms/botframework-state-service'));
}
}
}

Expand Down