Nous avons un badge personnalisé pour cela.
(plus d’informations sur Creating triggered custom badge queries et Enable Badge SQL)
Voici le code pour cela :
SELECT distinct p.user_id, p.created_at granted_at, p.id post_id
FROM badge_posts p
JOIN topics t ON t.id = p.topic_id
JOIN post_actions pa ON pa.post_id = p.id AND
post_action_type_id = (
SELECT id FROM post_action_types WHERE name_key = 'like'
) AND
pa.user_id IN (
SELECT gu.user_id
FROM group_users gu
WHERE gu.group_id = ( SELECT id FROM groups WHERE name ilike 'team' )
)
WHERE category_id = (
SELECT id FROM categories WHERE name ilike 'bug'
) AND p.post_number = 1
(En aparté, j’en ai également créé de similaires pour fonctionner à partir d’une Réaction spécifique d’un certain groupe
)