# Post Badges

**URL:** https://meta.discourse.org/t/post-badges/114722
**Category:** Theme component
**Tags:** post-badges, experimental
**Created:** [April 11, 2019, 3:52am UTC](https://meta.discourse.org/t/post-badges/114722 "2019-04-11T03:52:50Z")
**Posts on this page:** 20
**Page:** 5

<div class="post-metadata">

### Author: ![Anatolia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anatolia/32/133777_2.png) [@Anatolia](https://meta.discourse.org/u/Anatolia)
#### Post date: [March 26, 2020, 12:26am UTC](https://meta.discourse.org/t/post-badges/114722/101 "2020-03-26T00:26:53Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [March 26, 2020, 1:25am UTC](https://meta.discourse.org/t/post-badges/114722/102 "2020-03-26T01:25:38Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Anatolia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anatolia/32/133777_2.png) [@Anatolia](https://meta.discourse.org/u/Anatolia)
#### Post date: [March 26, 2020, 1:34am UTC](https://meta.discourse.org/t/post-badges/114722/103 "2020-03-26T01:34:18Z")

</div>

> [@tshenry](#):
>
> 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?

Yes, exactly.

> [@tshenry](#):
>
> 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

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

Result:  
 ![image](https://global.discourse-cdn.com/meta/original/3X/1/f/1f3d576866d3038cd30c64234de6a8fede2ee130.png)

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [March 26, 2020, 2:58am UTC](https://meta.discourse.org/t/post-badges/114722/104 "2020-03-26T02:58:14Z")

</div>

I’m pretty sure I figured it out.

> [@tshenry](#):
>
> Locale support will be #1 priority next time I get a chance to look at this.

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

---

<div class="post-metadata">

### Author: ![tpetrov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tpetrov/32/164643_2.png) [@tpetrov](https://meta.discourse.org/u/tpetrov)
#### Post date: [March 26, 2020, 6:58am UTC](https://meta.discourse.org/t/post-badges/114722/105 "2020-03-26T06:58:06Z")

</div>

It didn’t show in the “available for updates components”, so I deleted it and installed from  
[GitHub - discourse/discourse-post-badges](https://github.com/discourse/discourse-post-badges)

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

---

<div class="post-metadata">

### Author: ![Anatolia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anatolia/32/133777_2.png) [@Anatolia](https://meta.discourse.org/u/Anatolia)
#### Post date: [March 26, 2020, 2:24pm UTC](https://meta.discourse.org/t/post-badges/114722/106 "2020-03-26T14:24:44Z")

</div>

No issues left. Thank you.

@tshenry It has stopped working 🤔

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [March 26, 2020, 11:32pm UTC](https://meta.discourse.org/t/post-badges/114722/107 "2020-03-26T23:32:00Z")

</div>

> [@Anatolia](#):
>
> It has stopped working 🤔

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 🙂

---

<div class="post-metadata">

### Author: ![Anatolia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anatolia/32/133777_2.png) [@Anatolia](https://meta.discourse.org/u/Anatolia)
#### Post date: [March 26, 2020, 11:55pm UTC](https://meta.discourse.org/t/post-badges/114722/108 "2020-03-26T23:55:08Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [March 27, 2020, 1:00am UTC](https://meta.discourse.org/t/post-badges/114722/109 "2020-03-27T01:00:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [April 2, 2020, 11:29am UTC](https://meta.discourse.org/t/post-badges/114722/110 "2020-04-02T11:29:17Z")

</div>

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

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 2, 2020, 11:56pm UTC](https://meta.discourse.org/t/post-badges/114722/111 "2020-04-02T23:56:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)
#### Post date: [April 20, 2020, 12:20pm UTC](https://meta.discourse.org/t/post-badges/114722/113 "2020-04-20T12:20:33Z")

</div>

> [@RGJ](#):
>
> Warning - below is the top 10 requests for the past few hours on a site that is using this theme component.

> [@sam](#):
>
> Yes we are aware of this and are going to improve it.

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](https://global.discourse-cdn.com/meta/original/3X/f/e/fe2e5fa0dfabc444e8f51adbb49af752b871c3df.png)

Log:

```plaintext
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

```

---

<div class="post-metadata">

### Author: ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)
#### Post date: [April 20, 2020, 12:37pm UTC](https://meta.discourse.org/t/post-badges/114722/114 "2020-04-20T12:37:14Z")

</div>

> [@tshenry](#):
>
> Some default badges contain links in their descriptions. These will not display nicely as a tooltip, so it is recommended to customize the description at `/admin/customize/site_texts` . You can find what you need to modify by searching for part of the description’s current text.

> [@tshenry](#):
>
> When I work on updating this component, I’ll see if I can come up with a more graceful solution for this.

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:

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/f/6f5dc0436fd24664ff7fc1b58ee2c3c8c074fa96.png)

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.

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [May 26, 2020, 12:06pm UTC](https://meta.discourse.org/t/post-badges/114722/115 "2020-05-26T12:06:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jahan\_gagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jahan_gagan/32/501948_2.png) [@jahan\_gagan](https://meta.discourse.org/u/jahan_gagan)
#### Post date: [August 12, 2020, 12:51pm UTC](https://meta.discourse.org/t/post-badges/114722/116 "2020-08-12T12:51:53Z")

</div>

@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](https://github.com/jahan-ggn/discourse-trust-level-on-posts)

thoughts?

---

<div class="post-metadata">

### Author: ![davidkingham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidkingham/32/119528_2.png) [@davidkingham](https://meta.discourse.org/u/davidkingham)
#### Post date: [August 17, 2020, 1:53pm UTC](https://meta.discourse.org/t/post-badges/114722/117 "2020-08-17T13:53:56Z")

</div>

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.

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/0/e030750925725eea79b5bdce47d17a0e57c05fed.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/4/546ef8fd4228751517f843f6f176f290ac9d8597.png)

Line 27516

 ![image](https://global.discourse-cdn.com/meta/original/3X/b/9/b9abe101f8edfbc7b04e7409e8dd87dedb9e96fe.png)

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [October 2, 2020, 12:53pm UTC](https://meta.discourse.org/t/post-badges/114722/118 "2020-10-02T12:53:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [October 2, 2020, 11:17pm UTC](https://meta.discourse.org/t/post-badges/114722/119 "2020-10-02T23:17:24Z")

</div>

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.

> [@jahan\_gagan](#):
>
> thoughts?

> [@jrgong](#):
>
> How is this solution working so far? Has anyone else put it under scrutiny yet? 🙂

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.

_Poll ([view on site](https://meta.discourse.org/t/post-badges/114722/119))_

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.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [March 15, 2021, 2:52am UTC](https://meta.discourse.org/t/post-badges/114722/121 "2021-03-15T02:52:01Z")

</div>

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](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.

---

<div class="post-metadata">

### Author: ![Andrew8H](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrew8h/32/196005_2.png) [@Andrew8H](https://meta.discourse.org/u/Andrew8H)
#### Post date: [March 19, 2021, 1:59am UTC](https://meta.discourse.org/t/post-badges/114722/122 "2021-03-19T01:59:45Z")

</div>

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!

[Previous page](https://meta.discourse.org/t/post-badges/114722.md?page=4)

[Next page](https://meta.discourse.org/t/post-badges/114722.md?page=6)
