La primera insignia "Like" no se puede eliminar

Description: A user requested I revoke their First Like badge after they, themselves, un-liked a post, but the badge kept getting re-granted. Context can be found at my previous post in the support category.

Reproducible steps:

  1. Create a new user
  2. Like a post
  3. Receive the First Like badge
  4. Un-like the post
  5. Switch to an admin user
  6. Go to the admin panel for the user who liked the post
  7. Visit the Edit Badges option
  8. Click “Revoke” on the First Like badge
  9. Wait a bit (I’m not sure when does the backfill job run for this particular badge, but a day will surely do. Maybe try triggering all the badge-related jobs in Sidekiq to speed it up?)
  10. The badge is granted back to the user automatically, for the same post that was disliked and at the same date that the like was made

I have narrowed down the issue to this line of the SQL query for granting the badge, because, while the row in post_actions for the like action still exists after un-liking, it has its deleted_at column set to a date value, which the query does not take into account. I believe the fix for this would change the WHERE clause of the subquery to:

      WHERE post_action_type_id = 2 AND
        pa.deleted_at IS NULL AND
        (:backfill OR pa.post_id IN (:post_ids) )

but I don’t have a development environment set up or a lot of time to test out this fix myself.

Priority/Severity: I have solved this issue for myself by deleting the relevant post_actions rows already, and I’ve never received such a request before. I guess that doesn’t make it very high priority?

2 Me gusta

They liked a post. Un-liking a post does not change that they have proved that they know how to like a post. Perhaps they are eligible for a First Unlike Badge, but now that they have liked a post, they have liked a post. They get the badge for having liked a post. You can’t un-ring the bell.

That’s my guess.

Your solution was very clever. Another way to remove their badge would be to delete the user. :rofl:

2 Me gusta

That is true, but I still believe it is counter-intuitive how I, as an admin, cannot revoke said badge from the user, even after they un-liked the post. At least there should be some kind of notice on the “Revoke” button in the Edit Badges view about how the badge cannot be revoked? Instead of the current behavior, which is silently re-granting the badge during some backfilling job, making the admin wonder if they truly clicked that button or not.

2 Me gusta

Agreed.

I think my response would have been along the lines of:

I’m sorry, Dave. I’m afraid I can’t do that.

3 Me gusta