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

fix(channel-web): fix switching user language #5753

Merged
merged 1 commit into from
Dec 13, 2021

Conversation

laurentlp
Copy link
Contributor

Description

This PR adds the mapping between visitorId and userId logic inside the switchLanguage builtin action. This fixes changing the user language and updating the channel-web UI accordingly.

Another solution I tough about was to handle this logic inside the forVisitor function (packages/bp/src/core/realtime/payload-sdk-impl.ts). But I think it would be overkill to have to make sure the user sends a visitorId and if not, to check if the userId corresponds to some visitorId and then fetch this value.

We could also expose a getVisitorId in the SDK but considering that web_user_map is a temporary table and will be deprecated in the future, we might not want to go that route.

Please, let me know if you have a better idea of what we could do here!

Fixes botpress/v12#1541
Closes DEV-1984

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Use the builtin/switchLanguage function and set the language to fr and then en. You will see the UI if the webchat change from English to French and then back to English.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code

@linear
Copy link

linear bot commented Dec 13, 2021

DEV-1984 [BUG] switchLanguage action not working (botpress/borpress botpress/v12#1541)

Describe the bug
Due to the messaging split, bp.RealTimePayload.forVisitor(event.taget... is no longer working

To Reproduce
Steps to reproduce the behavior:

  1. Use the action switchLanguage from the builtin module, it will not work correctly

A room id is now expected, not as same as event.target

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: Windows
  • Browser Chrome
  • Botpress Version 12.26.6
  • NodeJS 12.18.1

botpress/borpress botpress/v12#1541 by @ davidvitora

Copy link
Contributor

@samuelmasse samuelmasse left a comment

Choose a reason for hiding this comment

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

LGTM

@laurentlp laurentlp merged commit 5ccebcf into master Dec 13, 2021
@laurentlp laurentlp deleted the llp_fix_switch_user_lang branch December 13, 2021 18:27
@EFF EFF mentioned this pull request Jan 17, 2022
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.

[BUG] switchLanguage action not working
2 participants