Skip to content

Don't start poll meetings component when DOM elements are not present#8676

Merged
andreslucena merged 1 commit intodevelopfrom
fix/js-error-meetings
Jan 3, 2022
Merged

Don't start poll meetings component when DOM elements are not present#8676
andreslucena merged 1 commit intodevelopfrom
fix/js-error-meetings

Conversation

@ferblape
Copy link
Copy Markdown
Contributor

@ferblape ferblape commented Jan 3, 2022

🎩 What? Why?

This PR fixes the PollComponent of Meetings module, which was being called in the DOM even when the container object didn't exist. With this PR this behaviour is prevented and the JS error is removed.

📌 Related Issues

Testing

Steps to reproduce the behavior:

  1. Sign in as admin
  2. Enable "Participants can create meetings" in the configuration of meetings in a participatory process
  3. Open the JavaScript console of your browsers web development tool
  4. Go to the meeting creation form of participants
  5. You won't see the error

Besides that, in the specs there was a warning showing the JS error:

WARNING 2022-01-03 10:59:38 +0100: http://19.lvh.me:52643/packs-test/js/vendors-node_modules_jquery_dist_jquery-exposed_js.js 4118:17 "jQuery.Deferred exception: Cannot read properties of undefined (reading 'questionsUrl')" "TypeError: Cannot read properties of undefined (reading 'questionsUrl')\n    at new PollComponent (http://19.lvh.me:52643/packs-test/js/decidim_meetings.js:417:32)\n    at HTMLDocument.\u003Canonymous> (http://19.lvh.me:52643/packs-test/js/decidim_meetings.js:322:14)\n    at mightThrow (http://19.lvh.me:52643/packs-test/js/vendors-node_modules_jquery_dist_jquery-exposed_js.js:3835:29)\n    at process (http://19.lvh.me:52643/packs-test/js/vendors-node_modules_jquery_dist_jquery-exposed_js.js:3903:12)" undefined

This warning has disappeared too. Because this was a JS error that didn't prevent the functionality to work I haven't added a test.

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • [ x ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

📷 Screenshots

Please add screenshots of the changes you're proposing
Description

♥️ Thank you!

@ferblape ferblape requested a review from andreslucena January 3, 2022 10:18
@andreslucena andreslucena added project: online-meetings Barcelona City Council contract module: meetings type: fix PRs that implement a fix for a bug labels Jan 3, 2022
Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

👍🏽

@andreslucena andreslucena merged commit a893139 into develop Jan 3, 2022
@andreslucena andreslucena deleted the fix/js-error-meetings branch January 3, 2022 14:40
@andreslucena
Copy link
Copy Markdown
Member

No need to backport this one, as the PR that introduced this feature (#8065) isn't in the last release (v0.25).

Thanks for the fix @ferblape

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: meetings project: online-meetings Barcelona City Council contract type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JS console exception from Polls when creating a meeting as participant

3 participants