Message Bus faalt bij het wijzigen van de gebruikersinstelling "Sla nieuwe gebruiker onboarding tips en badges over"

AI-generated summary

A bug was reported where toggling the “Skip new user onboarding tips and badges” setting causes a Message Bus failure, resulting in a console error. awesomerobot provided steps to reproduce the issue, showing the error occurs in the user-tips callback. Arkshine suggested adding a check for this.site.user_tips to prevent the error, noting the issue may stem from the MessageBus firing before the save completes. nbianca clarified that user_tips should always be set and proposed setting refresh: true for the site setting as a better fix, while acknowledging Arkshine’s solution adds protection. The issue was resolved with a fix submitted in a pull request: https://github.com/discourse/discourse/pull/21489.

To repro

  1. visit meta.discourse.org/my/preferences/interface

  2. Open your browser console

  3. toggle Skip new user onboarding tips and badges and click save

See the error in the console:

MESSAGE BUS FAIL: callback /user-tips/2770 caused exception onMessage/<@https://global.discourse-cdn.com/meta/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:4216:653
onMessage@https://global.discourse-cdn.com/meta/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:4216:597
U.prototype._run@https://global.discourse-cdn.com/meta/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:4446:94
U.prototype._join@https://global.discourse-cdn.com/meta/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:4445:256
U.prototype.join@https://global.discourse-cdn.com/meta/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:4408:13
p@https://global.discourse-cdn.com/meta/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:2570:63
m/<@https://global.discourse-cdn.com/meta/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:2573:8
b@https://global.discourse-cdn.com/meta/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:833:7
w@https://global.discourse-cdn.com/meta/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:833:274
P@https://global.discourse-cdn.com/meta/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:846:6
r</k/onProgressListener/t.onprogress@https://global.discourse-cdn.com/meta/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:849:163
EventHandlerNonNull*onProgressListener@https://global.discourse-cdn.com/meta/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:849:44
xhr@https://global.discourse-cdn.com/meta/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:850:27
send@https://global.discourse-cdn.com/meta/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:468:67
ajax@https://global.discourse-cdn.com/meta/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:448:12
l@https://global.discourse-cdn.com/meta/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:4065:10
initialize/n.ajax@https://global.discourse-cdn.com/meta/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:4069:531
k@https://global.discourse-cdn.com/meta/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:848:66
n@https://global.discourse-cdn.com/meta/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:857:25
r</start/e.onVisibilityChange@https://global.discourse-cdn.com/meta/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:858:166
callback@https://global.discourse-cdn.com/meta/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:4067:192
d@https://global.discourse-cdn.com/meta/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:5743:26
p@https://global.discourse-cdn.com/meta/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:5743:92
m@https://global.discourse-cdn.com/meta/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:5743:129

The toggle seems to work fine despite the error, so not sure if it’s an actual issue.

6 likes

It might be a good idea to check this.site.user_tips before. :smile:

  if (this.site.user_tips) {
    (seenUserTips || []).forEach((userTipId) => {
      this.currentUser.hideUserTipForever(
        Object.keys(this.site.user_tips).find(
          (id) => this.site.user_tips[id] === userTipId
        )
      );
    });
  }

I believe MessageBus is sent after saving is done; that’s why it works. It does not harm and should not be an actual issue.

3 likes

Technically, that should be always set. It is unset only when a user visits the page and admins enable user tips afterward. For this reason, I believe a better solution is to set refresh: true for that site setting. Anyway, I think your solution adds some more protection and fills in the gap between the time the site setting is changed and the page is refreshed.

Thank you for your interest! Here is the fix:

https://github.com/discourse/discourse/pull/21489

3 likes