Don't grant badges to users who don't exist?

I think the user ids are residing in the incoming links table. Those records are not dependently destroyed, and the sharing badge query only protects against the user_id being null in the incoming_links table:

https://github.com/discourse/discourse/blob/main/lib/badge_queries.rb#L199

The First Share badge should have a similar bug:

https://github.com/discourse/discourse/blob/main/lib/badge_queries.rb#L64

3 Likes