moodle-an-hochschulen / moodle-theme_boost_union

Theme Boost Union is an enhanced child theme of Boost which is intended, on the one hand, to make Boost simply more configurable and, on the other hand, to provide helpful additional features for the daily Moodle operation of admins, teachers and students.
GNU General Public License v3.0
68 stars 60 forks source link

starred courses popover in navbar throws js error on every page. #759

Closed davidscotson closed 6 days ago

davidscotson commented 1 week ago

Describe the bug On our 4.5 test site, enabling the "Show starred courses popover in the navbar" option in the settings causes a JS console error on every page.

To Reproduce Steps to reproduce the behavior:

  1. Go to /admin/settings.php?section=theme_boost_union_feel
  2. Scroll down to Navbar section.
  3. Enable the 'Show starred courses popover in the navbar (shownavbarstarredcourses)' option and save
  4. On the next page load there will a js console error, Uncaught TypeError: controller.registerEventListeners is not a function

Additional context When investigating this I switched between themes using the ?theme= functionality. The error persisted across other themes, and the star continued to be displayed in the navbar on Classic and vanilla Boost themes. After selecting a different theme in the settings to switch the theme entirely, the star in the navbar was still visible and active if enabled in Boost Union. I'm assuming that's not intended either.

abias commented 6 days ago

Hi @davidscotson ,

many thanks for raising this issue.

I can reproduce the JavaScript console error on Moodle 4.5 but also on older versions down to 4.1. I will investitate and hopefully fix it shortly.

Regarding your additional comment that the starred courses feature is shown for other active themes as well, you are completely right. We have missed that detail in the initial implementation. I have just pushed a PR on #762 to fix that and have created #761 for some volunteer to cover it with tests.

Cheers, Alex

abias commented 6 days ago

I think I found the reason for the JS console error as well: When building the starred courses feature, a JS line had been adopted by mistake from the notifications popover: https://github.com/moodle-an-hochschulen/moodle-theme_boost_union/pull/762/commits/d46182317e638d0e329ebb2c0bb01b0e44824957

This is removed now in the updated PR.