Set Title dialog shows multiple instances of the same badge (2)


(PJH) #1

Continuing the discussion from Set Title dialog shows multiple instances of the same badge:

There appears to have been a regression (or this didn’t make it in) - I’m seeing duplicates (again.)


(cpradio) #2

What branch are you using for Production? I see it in the Master branch still…


(PJH) #3

Master I believe.  


(cpradio) #4

Hmm… I just pulled latest on my instance and it still seems to work (using master). Seems all branches have my PR in them…

Can you tell me which badge(s) are being duplicated? Is it all of the ones that can be granted multiple times, or just a select few?


(PJH) #5

Strangely, it appears to be the one visible in the original report - the Mediocre Poster one - I have 8, but the dropdown lists 4 - one near the top, the others at the bottom. (Conversely, I have 2 XSS, but that appears once.)

Someone else first noticed it on that thread (#16739) they have 4 Mediocre and 3 are listed (confirmed.) Strangely in the same positions relative to the end as my last three if that’s at all relevant:

Mine:

Other member:


(cpradio) #6

Okay. I’ll play around with it later this week. Can you post a screenshot of the Badge Admin Area for the Mediocre Poster, so I can set it up the same?


(PJH) #7

Received 10 likes on a single post. In a thread/situation not obviously being abused for this purpose.
SELECT p.user_id, p.id post_id, p.updated_at granted_at
FROM badge_posts p
WHERE p.like_count >= 10 AND 
    p.topic_id not in (1000) AND
    (:backfill OR user_id IN (:user_ids) OR 0 IN (:post_ids) )

(Yes - I know I need to sort out that last clause…)


(cpradio) #8

Okay, this is a silly question, but by chance do you have any other badges named mediocre post in the badge admin area that are “not enabled”?

From a first try, I’ve yet to recreate the issue. I granted the badge to myself multiple times, and I only get one occurrence on my development box.


(Jens Maier) #9

items is probably not guaranteed to be sorted by badge name.


(cpradio) #10

Oh, that could be. I still need to reproduce though :frowning: So I can verify. I’ll play around with adding more badges to my test user to see if it eventually happens.


(cpradio) #11

Yep, I can recreate it now. Working on a fix :smile:


(cpradio) #12

PR Sent.
https://github.com/discourse/discourse/pull/2736


(Sam Saffron) #13