Post Badges

Okay, no need to re-installing for updates but I re-installed due to it’s not worked. New repo is not working as well.

1 Like

So just to be clear - you were able to update the component, but the update did not fix the issue for you? Then you deleted the old component and re-installed from the new repo?

I’m seeing it work without issue on two separate Discourse instances. Can you make sure you:

  • Added the component to the correct theme
  • Refreshed the page after adding the component.
  • Adjusted all of the settings according to your needs
3 Likes

Yes, exactly.

  • I added to my main theme
  • Refreshed the page
  • Settings done

Result:
image

4 Likes

I’m pretty sure I figured it out.

I completely forgot to follow up on this :sweat_smile: I just pushed a commit that should fix things for you. Let me know if you run into any other issues.

6 Likes

It didn’t show in the “available for updates components”, so I deleted it and installed from
GitHub - discourse/discourse-post-badges

It works as intended now.
Thanks - that was really quick!

6 Likes

No issues left. Thank you.

@tshenry It has stopped working :thinking:

5 Likes

The whole component, or are you back to the original problem with that setting not working? I just tested everything (with a non-english locale too) and everything appears to be working fine. I’ll need more details please :slight_smile:

2 Likes

No, it has stopped working completely this time.

I guess I found why it has stopped. My badge names are Turkish. I have changed the language from Turkish to English. Now I turned it back to Turkish and it’s working.

6 Likes

Cool. That is expected behavior at least for now. I don’t believe there is a way to avoid this when entering a badge into the setting by its name. I’ll consider adding additional support for entering a badge by ID to make things even more locale agnostic, but it will be a little while before I get around to it.

6 Likes

Warning - below is the top 10 requests for the past few hours on a site that is using this theme component.

It became really slow and it was one big rate limiting experience including hanging browsers and lots of complaints.

 214163 GET /user-badges
  29537 POST /message-bus
  14166 GET /assets
  13425 GET /user_avatar
  10125 GET /stylesheets
   8957 GET /theme-javascripts
   8131 GET /images
   7160 GET /letter_avatar
   2992 POST /topics
   2845 GET /t
12 Likes

Yes we are aware of this and are going to improve it.

9 Likes

I don’t know if this is related but I’m getting lots of errors when clicking on links which point to badges page lately. I have created a summary page for each user’s custom badges (with an emoji to go with it), and when clicking on a few links like [:z133:](/badges/133/-?username=user_name) in a row there is an error:

image

Log:

Message

Uncaught TypeError: Cannot read property 'users' of undefined
Url: https://discourse.forum.tld/assets/ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js
Line: 1
Column: 267440
Window Location: https://discourse.forum.tld/t/topic-slug/id

Backtrace

TypeError: Cannot read property 'users' of undefined
    at https://discourse.forum.tld/assets/plugins/discourse-presence-e4fe1148b25ac06931c3b78b8411907e35aef58f8dd5ac28a262cdd28fb6e51d.js:1:5982
    at E (https://discourse.forum.tld/assets/ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js:1:547359)
    at https://discourse.forum.tld/assets/ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js:1:547817
    at t.invoke (https://discourse.forum.tld/assets/ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js:1:490065)
    at e.t.flush (https://discourse.forum.tld/assets/ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js:1:489055)
    at e.t.flush (https://discourse.forum.tld/assets/ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js:1:491070)
    at e.t._end (https://discourse.forum.tld/assets/ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js:1:496499)
    at e.t.end (https://discourse.forum.tld/assets/ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js:1:493035)
    at e.t._run (https://discourse.forum.tld/assets/ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js:1:497037)

Env

HTTP HOSTS: discourse.forum.tld
1 Like

I’m using links in all my descriptions for custom badges like this:

Badge description followed by a link <a href="/t/topic-slug/id#heading--detailed-descrption-topic">➥</a>

which points to the detailed badge description topic. It works really well on the Badges page, but users are confused by the html codes which are displayed in the post badges tooltips:

If the anchor <a href=...>Description</a> tags could be stripped from the tooltip, leaving just the Description, it would probably fix most use cases.

4 Likes

Has this one been fixed in 2.5.X by any chance?

@tshenry i have found a work around to it that avoid multiple request calls to load user data. I have used in this theme component

https://github.com/jahan-ggn/discourse-trust-level-on-posts

thoughts?

4 Likes

This component is causing js errors when using the new keyboard shortcuts for prev/next topic that Sam added to core (gj). It’s a bit unpredictable but can be repro’ed consistently by using the shortcut to go to next topic until the error happens. If I remove the component this error never happens.

Line 27516

3 Likes

How is this solution working so far? Has anyone else put it under scrutiny yet? :slight_smile:

2 Likes

Just a heads up, I’m keeping track of everyone’s feedback, but working on this component has been a lower priority while we wait for the improvements @sam mentioned.

I haven’t tried it at this point, but it seems like it should be totally fine to use a similar approach for displaying trust level badges. It’s non-trust level badges that would need the improvement Sam mentioned.

It would be helpful to know how people use this component, or at least how they would like to use it.

What Badges Do You Want to Display?
  • Trust Level badges
  • Other badges
  • A mix of both

0 voters

If there’s enough interest in Trust Levels, I can make a separate “Trust Level Post Flair” component that can be deprecated once the performance of this component can be improved.

6 Likes

Just a note here that we’ve made an open source version of this in a plugin, which serializes the badges along with the post itself, to address the performance issue mentioned above

https://github.com/paviliondev/discourse-post-badges-plugin

As to the selection of which badges will be featured, the user does this themselves in their profile, in a new user-specific setting.

12 Likes

Has this component stopped displaying custom image uploads for anyone else? It defaults to the font awesome icon, and if no FA icon is selected, it displays “undefined”, regardless of whether a custom icon has been uploaded or not.

Thanks!

3 Likes