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

Make sure element has both binding and ix attributes #35247

Merged
merged 3 commits into from
Oct 30, 2024

Conversation

minhaminha
Copy link
Contributor

@minhaminha minhaminha commented Oct 22, 2024

Product Description

This fixes another edge case where if a user tries to change the language in a form that has a multimedia question in it, it'll complain about element.binding not existing.

Technical Summary

Jira Ticket

Previously, I changed the conditional to only move into the filename assignment logic if the returned element object wasn't empty but there was another edge case where the returned element could sometimes be a string (language slug). This PR makes is more explicit that it needs both the binding and ix attributes before entering that block.

Feature Flag

Multimedia in Web Apps FF

Safety Assurance

Safety story

Tested locally and on staging.
No data impact.

QA Plan

Re-testing with QA because there's been an uptick in bugs around this area recently.
QA Ticket

Rollback instructions

  • This PR can be reverted after deploy with no further considerations

Labels & Review

  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@minhaminha minhaminha added the product/feature-flag Change will only affect users who have a specific feature flag enabled label Oct 22, 2024
@dimagimon dimagimon added the Risk: Medium Change affects files that have been flagged as medium risk. label Oct 22, 2024
Comment on lines 708 to 709
if (Object.prototype.hasOwnProperty.call(element, 'binding') &&
Object.prototype.hasOwnProperty.call(element, 'ix') && allChildren && allChildren.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: underscore methods could make this cleaner

Suggested change
if (Object.prototype.hasOwnProperty.call(element, 'binding') &&
Object.prototype.hasOwnProperty.call(element, 'ix') && allChildren && allChildren.length > 0) {
if (_.has(element, 'binding') && _.has(element, 'ix') && !_.isEmpty(allChildren)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

applied - I love underscore now

@minhaminha minhaminha merged commit 436c78c into master Oct 30, 2024
12 checks passed
@minhaminha minhaminha deleted the ml/multimedia-bug-lang-change branch October 30, 2024 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product/feature-flag Change will only affect users who have a specific feature flag enabled QA Passed Risk: Medium Change affects files that have been flagged as medium risk.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants