Bug when editing badges - Trigger is changed

AI-generated summary

A user reports a bug where editing a badge in Discourse reverts the trigger setting to “When a user changes trust level,” even after manually changing it back. The issue occurs when editing badges that use a custom SQL query to prevent them from appearing in the badge granting list, with the trigger set to “Updated daily.” The user explains that the trigger resets upon page refresh, making editing cumbersome. Another user acknowledges the issue and references a related pull request that may address it. Shauny details the steps to reproduce, while j.jaffeux confirms the bug and plans to investigate further. j.jaffeux notes the issue remains unresolved but suspects a fix may be in progress via a GitHub pull request.

When editing an existing badge, the Trigger is changed so it always goes back to:

When a user changes trust level

Very annoying for editing lots of badges!

I haven’t been able to repro this, are you able to give me more details, maybe give me a repro from scratch please, or a video?

OK, I use the API to grant forum badges based on what people do on my site https://tardis.guide

So then I added a Badge Query which is impossible to earn to all of those badges, just so the badges don’t show up in the list for ‘granting badges’ - it was clogged up and I never needed them there.

So all my badges contain this SQL:

SELECT id user_id, created_at granted_at
FROM users
WHERE id = -1000

(This is the only way I know of to remove a badge from that dropdown list).

I set the trigger to “updated daily” just because it’s one that works.

But since the update, any time I edit a badge (maybe to change the description or the picture), the trigger value has changed to the first option because when I try to hit submit it says this:

And when I look, yes the trigger has changed to “when a user changes trust level”:

So I change it back to ‘updated daily’ and hit submit and it works.

But then if I simply refresh the page, it will go back to ‘when a user changes trust level’ so I can’t edit it without fixing that again.

Thanks

1 Like

Will try to look at this tomorrow and see if I can repro with these info, thanks.

I still haven’t been able to reproduce your exact issue, but I suspect this might help:

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

1 Like