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

**URL:** <https://meta.discourse.org/t/dont-grant-badges-to-users-who-dont-exist/185700>\
**Category:** Bug\
**Created:** [April 5, 2021, 9:28pm UTC](https://meta.discourse.org/t/dont-grant-badges-to-users-who-dont-exist/185700 "2021-04-05T21:28:11Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![William\_Houston](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/william_houston/32/199509_2.png) [@William\_Houston](https://meta.discourse.org/u/William_Houston)\
**Post date:** [July 22, 2021, 12:48am UTC](https://meta.discourse.org/t/dont-grant-badges-to-users-who-dont-exist/185700/7 "2021-07-22T00:48:24Z")

</div>

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](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](https://github.com/discourse/discourse/blob/main/lib/badge_queries.rb#L64)

---

_[View the full topic](https://meta.discourse.org/t/dont-grant-badges-to-users-who-dont-exist/185700)._
