Feature proposal: improved badge granting workflow

I agree with the omitting of the reason - the post that you trigger the badge from should be the reason.

Also I agree that the badges should be as per current workflow and not as popularity. I tend to use the filter for the badge I want so for example typing 15 would return all badges with 15 on it so if that is possible to implement that would be great.

I tend to use the forum mostly via smartphone, and typing to search is not possible or practical here.

There are loads of badges, but only one or two that mods would grant manually. That’s why I’d prefer these to appear at the top of the list

Completely understand that certainly one of the downfalls on mobile I find also as on desktop it’s much easier.

Personally I prefer in alphabetical order as have about 60 odd badges half of which are used quite a bit so having it in popular order I think for us would be confusing to find the one we want. I do however understand why you want it if there is only a couple you use all the time.

in my opinion, it would be great to have a setting for sorting(e.g. most used, alphabetical, recently used, etc by default) which can be configured but I’m digressing here and I feel that would be a topic on its own.

and I admit I don’t really open discourse on phone but I can think how it would be trouble some to keep searching but for now, having badge granting be on the same page either option 1 or 2 seem to be a big step up in terms of user experience regardless of the device you’re on

1 Like

Hi, I decided to go forward with option 2 and mock up how it would look like.

It ain’t finished yet but you should be able to roughly see how the workflow will go. The code is still very much band aid programming :sweat_smile:


Mobile (Nexus 6P using google developer mode):

some questions for the more senior developer,

  1. Right now, the widget is linked to post_menu.js.es6 treated like post-admin-menu. Is it okay to do that?
  2. I didn’t add the action to the handle bar in topic.hbs. Do I need to add it?
  3. To add the grant badge command itself, where do I look? I was thinking of searching from here

and for the user, what do you think so far?

also I don’t think I can proceed faster as I’m busy with day job but at the same time I’d like to finish this so I can get the hang of developing in discourse and apply for GSoC :smile:



Sorry for no news for quite some time, I was kinda busy with work and all.

So far I’ve went through the code implementing the badge granting on the current workflow.
Some thing’s I’ve encountered:

  1. The old workflow was on it’s own page /admin/users/[:user_id]/[:username]/badges which have a controller and model(connected to the user).
  2. The controller will calculate which badge can be granted (ones that haven’t been granted or can be granted multiple times)
  3. At that page you can grant multiple badge without refreshing (the controller will handle the removal of badge from grantable badge if it can only be granted once).
  4. it’s shown using the Ember component combo-box

from this, several problem that I’m facing would be:

  1. First of all, I want the widget to have the same look and feel as the old one and that requires me to connect the component to widget as shown below and I’m not sure yet on how to do that.
  1. Every time we open the grant badge widget, we have to get the badges that the user already have, get ones that we can grant, and show them. Right now I’m doing this via UserBadge.findByUsername(attrs.username) and Badge.findAll(). Instead of doing
    Badge.findAll() again and again, I can probably keep this somewhere. Any suggestion on how to get the grantableBadge in a better way?


  1. The 2 function I mentioned above are async call and I’m not sure how to populate the widget with data after async call. There’s probably a question in #dev somewhere but I haven’t found it yet :sweat_smile:

Oh and looking at modals in a glance, it seems they have template and controller? Would I be able to use the combo-box component there and would that be a better choice instead of widget?

p.s. does onebox-ing between list in markdown breaks it? I like to onebox between list sometimes and my list starts over from 1.

p.p.s. I always feel like my reply become a long essay hope it’s not too troublesome to read :sweat_smile:


Hi everyone! I am working on this topic as my first contribution for the Outreachy Program. I am right now trying to understand the whole code and managed to:

  • add a button to the post/admin/menu.js6 to grant a badge
  • create a modal that asks the user for the grant they want to grant the user

obviously these are not that difficult tasks but I am trying my best ^^

I have one first question (more to come, for sure): I created a Model and a Controller for the Modal. I would like to import all grantable Badges for the user to the Model, do you know where could I import them from? Or should I redefine the grantable Badges again?


I have not looked at this carefully, but I am not sure that we carry that list around, it is ok to make an extra ajax call when you open the modal to get the list.

I am sorry, could you please explain further? Which kind ajax call should I make? Sorry, but I am a bit lost. :slight_smile:

Would the Badges page JSON do it?


1 Like

Hi everyone :slight_smile: I forked the repository and did some commits as I think it could be easier then to comment. I would appreciate some guidance before I get more lost :slight_smile: You can see my commits here:


  • I created a select button in the tanner menu (post-admin-menu) as UX for the feature.
  • This button renders a modal that should show the grantable Badges and add the url of the post automatically as a reason. As you can see I was able to pass the object of the selected post, but I don’t know how to read its attributes (this is my first ember project), in order to get the url. Is there any easy solution? Any suggestions?
  • Also I would like to be able to read all the grantableBadges for the user. I don’t know if I should directly call them from the grant-badges controller or import them from somewhere else as I did with the selectedPost. What do you think? Any ideas?

Any other feedback is also welcome. Thanks in advance!


@mauditecandela I am sorry for the almost infinite delay here, where is this change at now? Are you still going to give it a shot?

1 Like

I was just wondering the same as this would be such an immense time saver for us in granting custom badges :slight_smile:




The changes align with the discussion in this topic

A new Grant Badge option is added to the post admin wrench

It opens up a modal for the admin to choose a specific badge to be granted to the user.

The “badge reason” is not shown on purpose and automatically attributed to the post from which the “grant badge” action is triggered. I’ve also considered showing a readonly “badge reason” input box, but the current approach seems cleaner.

Let me know what you think; open to suggestions!


Looks great! Thanks so much for coding this up. I hope it makes it into the codebase soon.

One minor point - would it be possible to exclude the badges such as “First Mention,” which are normally granted automatically as opposed to manually?

Also, if possible, order the badge list by the count of manual grants for each badge (most commonly-granted badges at the top of the list)?


would it be possible to exclude the badges such as “First Mention,” which are normally granted automatically as opposed to manually?

I thought of this before, but eventually decided to include all badges (same behavior as the admin page), since having less to choose from may be more problematic.

if possible, order the badge list by the count of manual grants for each badge

I can totally see this being helpful to granting certain badges manually repeatedly. (On a technical note, I think we will need an additional database column and an index.) In the worst case that this does not happen, the dropdown is completely filterable.

What do you think @sam?

I think we got to remove all the “automatically granted badges” from both places. The trouble with including them is that the schedule will kick in and remove the badge later on.

I would not muck with ordering though for now, seems complicated.


This is one piece of work we have been hoping someone would pick up as will save us so much time - thank you @xrav3nz for putting this together!


Works very nicely, thank you @xrav3nz :+1:

One request - could this feature be enabled for moderators? It seems only admins can do it at the moment.

1 Like

Good to hear! :slight_smile:

I think you’re right that it should be enabled for moderators too (my bad). I’ll open a PR later to correct it unless someone in the team beats me to it.

EDIT: here’s the two-line PR