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: edit translated caroussel data #122

Merged
merged 9 commits into from
Sep 28, 2021
Merged

Conversation

EFF
Copy link
Member

@EFF EFF commented Sep 24, 2021

Notice this line is the original code, the comment mentions we should ignore array arrays of empty objects

return _.every(
Object.keys(formData).map(x => {
// Ignore undefined and booleans, since they are set by default
if (!formData[x] || _.isBoolean(formData[x])) {
return
}
// Ignore array with empty objects (eg: skill choice)
if (_.isArray(formData[x]) && !formData[x].filter(_.isEmpty).length) {
return
}
return formData[x]
}),
_.isEmpty
)
}

In this code at line 27, we return undefined if the array has not empty objects !formData[x].filter(_.isEmpty).length

I rewrote the logic for something much simpler, yet readable.

Fixes #108
Closes : DEV-1825 & DEV-1086

@linear
Copy link

linear bot commented Sep 27, 2021

DEV-1086 Carousel Translation (botpress/botpress #3864)

You cannot translate Carousel content. When you try to, text defaults back to the original content.

Steps to reproduce the behaviour:

  1. Activate Botpress Pro, set two different languages in your bot configuration.
  2. In your default language, create a carousel with two different cards (one with image, one with action > Open URL)
  3. Change language to secondary
  4. Edit Carousel. You cannot change the content

Expected behavior
Text, images and links should be replaceable in different languages

Screenshots
Botpress_Card_translation_bug.mov.zip

Environment:

  • Botpress Version 12.10.5

@laurentlp
Copy link
Contributor

@EFF What's the link between this PR and DEV-1580?

Copy link
Contributor

@laurentlp laurentlp left a comment

Choose a reason for hiding this comment

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

Small comment other than that LGTM!

packages/studio-ui/src/web/util/NodeFormData.ts Outdated Show resolved Hide resolved
@botpress botpress deleted a comment from linear bot Sep 27, 2021
@linear
Copy link

linear bot commented Sep 27, 2021

DEV-1825 [BUG] Content of carousel in arabic is not saved (botpress/studio #108)

I have FR/AR bot.

I'am trying to translate the content of my carousel from FR to AR.

  • I set my bot to AR
    1. I click on the title or content of my carousel
    1. I write in arabic
    1. I click outside the input
  • 3 bis) The new arabic content disappear and the old content (in french) appear again

image

Version : 12.26.2

botpress/studio #108 by @ Jeremynano

laurentlp
laurentlp previously approved these changes Sep 27, 2021
Copy link
Contributor

@laurentlp laurentlp left a comment

Choose a reason for hiding this comment

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

Tested and working fine! Good job!!

@EFF
Copy link
Member Author

EFF commented Sep 28, 2021

@laurentlp I added typings but it's the worst typing we could add as by debugging, there is a single key in the object and its any. We also read a second key that is also a type any and return it as is if it's defined (although I didn't manage to see it defined).

To be honest that whole file should be re-written properly

@EFF EFF merged commit feaaafd into master Sep 28, 2021
@EFF EFF deleted the fd_fixcaroussel-translation branch September 28, 2021 13:50
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] Content of carousel in arabic is not saved
2 participants