Improved badge granting workflow

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:

https://github.com/mauditecandela/discourse/commit/c8155861ad33269eb14abb52436bfeef54c25def

  • 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!

6 Likes

@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:

2 Likes

:wink:

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


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!

14 Likes

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)?

5 Likes

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.

11 Likes

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!

3 Likes

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

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

9 Likes

A post was split to a new topic: Display granted badge underneath post