spec/fixtures/badges.json in discourse_api-0.11.0 vs spec/fixtures/badges.json in discourse_api-0.12.0
- old
+ new
@@ -1,569 +1,569 @@
-{
- "badges": [
- {
- "id": 9,
- "name": "Autobiographer",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 1,
- "system": true,
- "query": " SELECT u.id user_id, current_timestamp granted_at\n FROM users u\n JOIN user_profiles up on u.id = up.user_id\n WHERE bio_raw IS NOT NULL AND LENGTH(TRIM(bio_raw)) > 10 AND\n uploaded_avatar_id IS NOT NULL AND\n (:backfill OR u.id IN (:user_ids) )\n",
- "trigger": 8,
- "target_posts": false,
- "auto_revoke": true,
- "show_posts": false,
- "badge_type_id": 3
- },
- {
- "id": 11,
- "name": "First Like",
- "description": null,
- "grant_count": 1,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 1,
- "system": true,
- "query": " SELECT pa1.user_id, pa1.created_at granted_at, pa1.post_id\n FROM (\n SELECT pa.user_id, min(pa.id) id\n FROM post_actions pa\n JOIN badge_posts p on p.id = pa.post_id\n WHERE post_action_type_id = 2 AND\n (:backfill OR pa.post_id IN (:post_ids) )\n GROUP BY pa.user_id\n ) x\n JOIN post_actions pa1 on pa1.id = x.id\n",
- "trigger": 1,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 3
- },
- {
- "id": 14,
- "name": "First Link",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 1,
- "system": true,
- "query": " SELECT l.user_id, l.post_id, l.created_at granted_at\n FROM\n (\n SELECT MIN(l1.id) id\n FROM topic_links l1\n JOIN badge_posts p1 ON p1.id = l1.post_id\n JOIN badge_posts p2 ON p2.id = l1.link_post_id\n WHERE NOT reflection AND p1.topic_id <> p2.topic_id AND not quote AND\n (:backfill OR ( p1.id in (:post_ids) ))\n GROUP BY l1.user_id\n ) ids\n JOIN topic_links l ON l.id = ids.id\n",
- "trigger": 2,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 3
- },
- {
- "id": 15,
- "name": "First Quote",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 1,
- "system": true,
- "query": " SELECT ids.user_id, q.post_id, q.created_at granted_at\n FROM\n (\n SELECT p1.user_id, MIN(q1.id) id\n FROM quoted_posts q1\n JOIN badge_posts p1 ON p1.id = q1.post_id\n JOIN badge_posts p2 ON p2.id = q1.quoted_post_id\n WHERE (:backfill OR ( p1.id IN (:post_ids) ))\n GROUP BY p1.user_id\n ) ids\n JOIN quoted_posts q ON q.id = ids.id\n",
- "trigger": 2,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 3
- },
- {
- "id": 12,
- "name": "First Share",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 1,
- "system": true,
- "query": " SELECT views.user_id, i2.post_id, i2.created_at granted_at\n FROM\n (\n SELECT i.user_id, MIN(i.id) i_id\n FROM incoming_links i\n JOIN badge_posts p on p.id = i.post_id\n WHERE i.user_id IS NOT NULL\n GROUP BY i.user_id\n ) as views\n JOIN incoming_links i2 ON i2.id = views.i_id\n",
- "trigger": 0,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 3
- },
- {
- "id": 16,
- "name": "Read Guidelines",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 1,
- "system": true,
- "query": " SELECT user_id, read_faq granted_at\n FROM user_stats\n WHERE read_faq IS NOT NULL AND (user_id IN (:user_ids) OR :backfill)\n",
- "trigger": 8,
- "target_posts": false,
- "auto_revoke": true,
- "show_posts": false,
- "badge_type_id": 3
- },
- {
- "id": 17,
- "name": "Reader",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 1,
- "system": true,
- "query": " SELECT id user_id, current_timestamp granted_at\n FROM users\n WHERE id IN\n (\n SELECT pt.user_id\n FROM post_timings pt\n JOIN badge_posts b ON b.post_number = pt.post_number AND\n b.topic_id = pt.topic_id\n JOIN topics t ON t.id = pt.topic_id\n LEFT JOIN user_badges ub ON ub.badge_id = 17 AND ub.user_id = pt.user_id\n WHERE ub.id IS NULL AND t.posts_count > 100\n GROUP BY pt.user_id, pt.topic_id, t.posts_count\n HAVING count(*) >= t.posts_count\n )\n",
- "trigger": null,
- "target_posts": false,
- "auto_revoke": false,
- "show_posts": false,
- "badge_type_id": 3
- },
- {
- "id": 23,
- "name": "Great Share",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": true,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 2,
- "system": true,
- "query": " SELECT views.user_id, i2.post_id, i2.created_at granted_at\n FROM\n (\n SELECT i.user_id, MIN(i.id) i_id\n FROM incoming_links i\n JOIN badge_posts p on p.id = i.post_id\n WHERE i.user_id IS NOT NULL\n GROUP BY i.user_id,i.post_id\n HAVING COUNT(*) > 1000\n ) as views\n JOIN incoming_links i2 ON i2.id = views.i_id\n",
- "trigger": 0,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 1
- },
- {
- "id": 22,
- "name": "Good Share",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": true,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 2,
- "system": true,
- "query": " SELECT views.user_id, i2.post_id, i2.created_at granted_at\n FROM\n (\n SELECT i.user_id, MIN(i.id) i_id\n FROM incoming_links i\n JOIN badge_posts p on p.id = i.post_id\n WHERE i.user_id IS NOT NULL\n GROUP BY i.user_id,i.post_id\n HAVING COUNT(*) > 300\n ) as views\n JOIN incoming_links i2 ON i2.id = views.i_id\n",
- "trigger": 0,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 2
- },
- {
- "id": 10,
- "name": "Editor",
- "description": null,
- "grant_count": 1,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 2,
- "system": true,
- "query": " SELECT p.user_id, min(p.id) post_id, min(p.created_at) granted_at\n FROM badge_posts p\n WHERE p.self_edits > 0 AND\n (:backfill OR p.id IN (:post_ids) )\n GROUP BY p.user_id\n",
- "trigger": 2,
- "target_posts": false,
- "auto_revoke": true,
- "show_posts": false,
- "badge_type_id": 3
- },
- {
- "id": 13,
- "name": "First Flag",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 2,
- "system": true,
- "query": " SELECT pa1.user_id, pa1.created_at granted_at, pa1.post_id\n FROM (\n SELECT pa.user_id, min(pa.id) id\n FROM post_actions pa\n JOIN badge_posts p on p.id = pa.post_id\n WHERE post_action_type_id IN (3,4,7,8) AND\n (:backfill OR pa.post_id IN (:post_ids) )\n GROUP BY pa.user_id\n ) x\n JOIN post_actions pa1 on pa1.id = x.id\n",
- "trigger": 1,
- "target_posts": true,
- "auto_revoke": false,
- "show_posts": false,
- "badge_type_id": 3
- },
- {
- "id": 21,
- "name": "Nice Share",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": true,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 2,
- "system": true,
- "query": " SELECT views.user_id, i2.post_id, i2.created_at granted_at\n FROM\n (\n SELECT i.user_id, MIN(i.id) i_id\n FROM incoming_links i\n JOIN badge_posts p on p.id = i.post_id\n WHERE i.user_id IS NOT NULL\n GROUP BY i.user_id,i.post_id\n HAVING COUNT(*) > 25\n ) as views\n JOIN incoming_links i2 ON i2.id = views.i_id\n",
- "trigger": 0,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 3
- },
- {
- "id": 5,
- "name": "Welcome",
- "description": null,
- "grant_count": 1,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 2,
- "system": true,
- "query": " SELECT p.user_id, min(post_id) post_id, min(pa.created_at) granted_at\n FROM post_actions pa\n JOIN badge_posts p on p.id = pa.post_id\n WHERE post_action_type_id = 2 AND\n (:backfill OR pa.post_id IN (:post_ids) )\n GROUP BY p.user_id\n",
- "trigger": 1,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 3
- },
- {
- "id": 8,
- "name": "Great Post",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": true,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 3,
- "system": true,
- "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number > 1 AND p.like_count >= 50 AND\n (:backfill OR p.id IN (:post_ids) )\n",
- "trigger": 1,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 1
- },
- {
- "id": 20,
- "name": "Great Topic",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": true,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 3,
- "system": true,
- "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number = 1 AND p.like_count >= 50 AND\n (:backfill OR p.id IN (:post_ids) )\n",
- "trigger": 1,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 1
- },
- {
- "id": 7,
- "name": "Good Post",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": true,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 3,
- "system": true,
- "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number > 1 AND p.like_count >= 25 AND\n (:backfill OR p.id IN (:post_ids) )\n",
- "trigger": 1,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 2
- },
- {
- "id": 19,
- "name": "Good Topic",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": true,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 3,
- "system": true,
- "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number = 1 AND p.like_count >= 25 AND\n (:backfill OR p.id IN (:post_ids) )\n",
- "trigger": 1,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 2
- },
- {
- "id": 6,
- "name": "Nice Post",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": true,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 3,
- "system": true,
- "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number > 1 AND p.like_count >= 10 AND\n (:backfill OR p.id IN (:post_ids) )\n",
- "trigger": 1,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 3
- },
- {
- "id": 18,
- "name": "Nice Topic",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": true,
- "icon": "fa-certificate",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 3,
- "system": true,
- "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number = 1 AND p.like_count >= 10 AND\n (:backfill OR p.id IN (:post_ids) )\n",
- "trigger": 1,
- "target_posts": true,
- "auto_revoke": true,
- "show_posts": true,
- "badge_type_id": 3
- },
- {
- "id": 4,
- "name": "Leader",
- "description": null,
- "grant_count": 0,
- "allow_title": true,
- "multiple_grant": false,
- "icon": "fa-user",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 4,
- "system": true,
- "query": "\n SELECT u.id user_id, current_timestamp granted_at FROM users u\n WHERE trust_level >= 4 AND (\n :backfill OR u.id IN (:user_ids)\n )\n",
- "trigger": 4,
- "target_posts": false,
- "auto_revoke": true,
- "show_posts": false,
- "badge_type_id": 1
- },
- {
- "id": 3,
- "name": "Regular",
- "description": null,
- "grant_count": 0,
- "allow_title": true,
- "multiple_grant": false,
- "icon": "fa-user",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 4,
- "system": true,
- "query": "\n SELECT u.id user_id, current_timestamp granted_at FROM users u\n WHERE trust_level >= 3 AND (\n :backfill OR u.id IN (:user_ids)\n )\n",
- "trigger": 4,
- "target_posts": false,
- "auto_revoke": true,
- "show_posts": false,
- "badge_type_id": 2
- },
- {
- "id": 1,
- "name": "Basic User",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-user",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 4,
- "system": true,
- "query": "\n SELECT u.id user_id, current_timestamp granted_at FROM users u\n WHERE trust_level >= 1 AND (\n :backfill OR u.id IN (:user_ids)\n )\n",
- "trigger": 4,
- "target_posts": false,
- "auto_revoke": true,
- "show_posts": false,
- "badge_type_id": 3
- },
- {
- "id": 2,
- "name": "Member",
- "description": null,
- "grant_count": 0,
- "allow_title": false,
- "multiple_grant": false,
- "icon": "fa-user",
- "image": null,
- "listable": true,
- "enabled": true,
- "badge_grouping_id": 4,
- "system": true,
- "query": "\n SELECT u.id user_id, current_timestamp granted_at FROM users u\n WHERE trust_level >= 2 AND (\n :backfill OR u.id IN (:user_ids)\n )\n",
- "trigger": 4,
- "target_posts": false,
- "auto_revoke": true,
- "show_posts": false,
- "badge_type_id": 3
- }
- ],
- "badge_types": [
- {
- "id": 3,
- "name": "Bronze",
- "sort_order": 7
- },
- {
- "id": 1,
- "name": "Gold",
- "sort_order": 9
- },
- {
- "id": 2,
- "name": "Silver",
- "sort_order": 8
- }
- ],
- "badge_groupings": [
- {
- "id": 1,
- "name": "Getting Started",
- "description": null,
- "position": 10
- },
- {
- "id": 2,
- "name": "Community",
- "description": null,
- "position": 11
- },
- {
- "id": 3,
- "name": "Posting",
- "description": null,
- "position": 12
- },
- {
- "id": 4,
- "name": "Trust Level",
- "description": null,
- "position": 13
- },
- {
- "id": 5,
- "name": "Other",
- "description": null,
- "position": 14
- }
- ],
- "admin_badges": {
- "protected_system_fields": [
- "badge_type_id",
- "multiple_grant",
- "target_posts",
- "show_posts",
- "query",
- "trigger",
- "auto_revoke",
- "listable"
- ],
- "triggers": {
- "none": 0,
- "post_action": 1,
- "post_revision": 2,
- "trust_level_change": 4,
- "user_change": 8
- },
- "badge_ids": [
- 9,
- 11,
- 14,
- 15,
- 12,
- 16,
- 17,
- 23,
- 22,
- 10,
- 13,
- 21,
- 5,
- 8,
- 20,
- 7,
- 19,
- 6,
- 18,
- 4,
- 3,
- 1,
- 2
- ],
- "badge_grouping_ids": [
- 1,
- 2,
- 3,
- 4,
- 5
- ],
- "badge_type_ids": [
- 1,
- 2,
- 3
- ]
- }
-}
+{
+ "badges": [
+ {
+ "id": 9,
+ "name": "Autobiographer",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 1,
+ "system": true,
+ "query": " SELECT u.id user_id, current_timestamp granted_at\n FROM users u\n JOIN user_profiles up on u.id = up.user_id\n WHERE bio_raw IS NOT NULL AND LENGTH(TRIM(bio_raw)) > 10 AND\n uploaded_avatar_id IS NOT NULL AND\n (:backfill OR u.id IN (:user_ids) )\n",
+ "trigger": 8,
+ "target_posts": false,
+ "auto_revoke": true,
+ "show_posts": false,
+ "badge_type_id": 3
+ },
+ {
+ "id": 11,
+ "name": "First Like",
+ "description": null,
+ "grant_count": 1,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 1,
+ "system": true,
+ "query": " SELECT pa1.user_id, pa1.created_at granted_at, pa1.post_id\n FROM (\n SELECT pa.user_id, min(pa.id) id\n FROM post_actions pa\n JOIN badge_posts p on p.id = pa.post_id\n WHERE post_action_type_id = 2 AND\n (:backfill OR pa.post_id IN (:post_ids) )\n GROUP BY pa.user_id\n ) x\n JOIN post_actions pa1 on pa1.id = x.id\n",
+ "trigger": 1,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 3
+ },
+ {
+ "id": 14,
+ "name": "First Link",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 1,
+ "system": true,
+ "query": " SELECT l.user_id, l.post_id, l.created_at granted_at\n FROM\n (\n SELECT MIN(l1.id) id\n FROM topic_links l1\n JOIN badge_posts p1 ON p1.id = l1.post_id\n JOIN badge_posts p2 ON p2.id = l1.link_post_id\n WHERE NOT reflection AND p1.topic_id <> p2.topic_id AND not quote AND\n (:backfill OR ( p1.id in (:post_ids) ))\n GROUP BY l1.user_id\n ) ids\n JOIN topic_links l ON l.id = ids.id\n",
+ "trigger": 2,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 3
+ },
+ {
+ "id": 15,
+ "name": "First Quote",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 1,
+ "system": true,
+ "query": " SELECT ids.user_id, q.post_id, q.created_at granted_at\n FROM\n (\n SELECT p1.user_id, MIN(q1.id) id\n FROM quoted_posts q1\n JOIN badge_posts p1 ON p1.id = q1.post_id\n JOIN badge_posts p2 ON p2.id = q1.quoted_post_id\n WHERE (:backfill OR ( p1.id IN (:post_ids) ))\n GROUP BY p1.user_id\n ) ids\n JOIN quoted_posts q ON q.id = ids.id\n",
+ "trigger": 2,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 3
+ },
+ {
+ "id": 12,
+ "name": "First Share",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 1,
+ "system": true,
+ "query": " SELECT views.user_id, i2.post_id, i2.created_at granted_at\n FROM\n (\n SELECT i.user_id, MIN(i.id) i_id\n FROM incoming_links i\n JOIN badge_posts p on p.id = i.post_id\n WHERE i.user_id IS NOT NULL\n GROUP BY i.user_id\n ) as views\n JOIN incoming_links i2 ON i2.id = views.i_id\n",
+ "trigger": 0,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 3
+ },
+ {
+ "id": 16,
+ "name": "Read Guidelines",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 1,
+ "system": true,
+ "query": " SELECT user_id, read_faq granted_at\n FROM user_stats\n WHERE read_faq IS NOT NULL AND (user_id IN (:user_ids) OR :backfill)\n",
+ "trigger": 8,
+ "target_posts": false,
+ "auto_revoke": true,
+ "show_posts": false,
+ "badge_type_id": 3
+ },
+ {
+ "id": 17,
+ "name": "Reader",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 1,
+ "system": true,
+ "query": " SELECT id user_id, current_timestamp granted_at\n FROM users\n WHERE id IN\n (\n SELECT pt.user_id\n FROM post_timings pt\n JOIN badge_posts b ON b.post_number = pt.post_number AND\n b.topic_id = pt.topic_id\n JOIN topics t ON t.id = pt.topic_id\n LEFT JOIN user_badges ub ON ub.badge_id = 17 AND ub.user_id = pt.user_id\n WHERE ub.id IS NULL AND t.posts_count > 100\n GROUP BY pt.user_id, pt.topic_id, t.posts_count\n HAVING count(*) >= t.posts_count\n )\n",
+ "trigger": null,
+ "target_posts": false,
+ "auto_revoke": false,
+ "show_posts": false,
+ "badge_type_id": 3
+ },
+ {
+ "id": 23,
+ "name": "Great Share",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": true,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 2,
+ "system": true,
+ "query": " SELECT views.user_id, i2.post_id, i2.created_at granted_at\n FROM\n (\n SELECT i.user_id, MIN(i.id) i_id\n FROM incoming_links i\n JOIN badge_posts p on p.id = i.post_id\n WHERE i.user_id IS NOT NULL\n GROUP BY i.user_id,i.post_id\n HAVING COUNT(*) > 1000\n ) as views\n JOIN incoming_links i2 ON i2.id = views.i_id\n",
+ "trigger": 0,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 1
+ },
+ {
+ "id": 22,
+ "name": "Good Share",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": true,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 2,
+ "system": true,
+ "query": " SELECT views.user_id, i2.post_id, i2.created_at granted_at\n FROM\n (\n SELECT i.user_id, MIN(i.id) i_id\n FROM incoming_links i\n JOIN badge_posts p on p.id = i.post_id\n WHERE i.user_id IS NOT NULL\n GROUP BY i.user_id,i.post_id\n HAVING COUNT(*) > 300\n ) as views\n JOIN incoming_links i2 ON i2.id = views.i_id\n",
+ "trigger": 0,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 2
+ },
+ {
+ "id": 10,
+ "name": "Editor",
+ "description": null,
+ "grant_count": 1,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 2,
+ "system": true,
+ "query": " SELECT p.user_id, min(p.id) post_id, min(p.created_at) granted_at\n FROM badge_posts p\n WHERE p.self_edits > 0 AND\n (:backfill OR p.id IN (:post_ids) )\n GROUP BY p.user_id\n",
+ "trigger": 2,
+ "target_posts": false,
+ "auto_revoke": true,
+ "show_posts": false,
+ "badge_type_id": 3
+ },
+ {
+ "id": 13,
+ "name": "First Flag",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 2,
+ "system": true,
+ "query": " SELECT pa1.user_id, pa1.created_at granted_at, pa1.post_id\n FROM (\n SELECT pa.user_id, min(pa.id) id\n FROM post_actions pa\n JOIN badge_posts p on p.id = pa.post_id\n WHERE post_action_type_id IN (3,4,7,8) AND\n (:backfill OR pa.post_id IN (:post_ids) )\n GROUP BY pa.user_id\n ) x\n JOIN post_actions pa1 on pa1.id = x.id\n",
+ "trigger": 1,
+ "target_posts": true,
+ "auto_revoke": false,
+ "show_posts": false,
+ "badge_type_id": 3
+ },
+ {
+ "id": 21,
+ "name": "Nice Share",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": true,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 2,
+ "system": true,
+ "query": " SELECT views.user_id, i2.post_id, i2.created_at granted_at\n FROM\n (\n SELECT i.user_id, MIN(i.id) i_id\n FROM incoming_links i\n JOIN badge_posts p on p.id = i.post_id\n WHERE i.user_id IS NOT NULL\n GROUP BY i.user_id,i.post_id\n HAVING COUNT(*) > 25\n ) as views\n JOIN incoming_links i2 ON i2.id = views.i_id\n",
+ "trigger": 0,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 3
+ },
+ {
+ "id": 5,
+ "name": "Welcome",
+ "description": null,
+ "grant_count": 1,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 2,
+ "system": true,
+ "query": " SELECT p.user_id, min(post_id) post_id, min(pa.created_at) granted_at\n FROM post_actions pa\n JOIN badge_posts p on p.id = pa.post_id\n WHERE post_action_type_id = 2 AND\n (:backfill OR pa.post_id IN (:post_ids) )\n GROUP BY p.user_id\n",
+ "trigger": 1,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 3
+ },
+ {
+ "id": 8,
+ "name": "Great Post",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": true,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 3,
+ "system": true,
+ "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number > 1 AND p.like_count >= 50 AND\n (:backfill OR p.id IN (:post_ids) )\n",
+ "trigger": 1,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 1
+ },
+ {
+ "id": 20,
+ "name": "Great Topic",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": true,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 3,
+ "system": true,
+ "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number = 1 AND p.like_count >= 50 AND\n (:backfill OR p.id IN (:post_ids) )\n",
+ "trigger": 1,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 1
+ },
+ {
+ "id": 7,
+ "name": "Good Post",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": true,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 3,
+ "system": true,
+ "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number > 1 AND p.like_count >= 25 AND\n (:backfill OR p.id IN (:post_ids) )\n",
+ "trigger": 1,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 2
+ },
+ {
+ "id": 19,
+ "name": "Good Topic",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": true,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 3,
+ "system": true,
+ "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number = 1 AND p.like_count >= 25 AND\n (:backfill OR p.id IN (:post_ids) )\n",
+ "trigger": 1,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 2
+ },
+ {
+ "id": 6,
+ "name": "Nice Post",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": true,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 3,
+ "system": true,
+ "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number > 1 AND p.like_count >= 10 AND\n (:backfill OR p.id IN (:post_ids) )\n",
+ "trigger": 1,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 3
+ },
+ {
+ "id": 18,
+ "name": "Nice Topic",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": true,
+ "icon": "fa-certificate",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 3,
+ "system": true,
+ "query": "\n SELECT p.user_id, p.id post_id, p.updated_at granted_at\n FROM badge_posts p\n WHERE p.post_number = 1 AND p.like_count >= 10 AND\n (:backfill OR p.id IN (:post_ids) )\n",
+ "trigger": 1,
+ "target_posts": true,
+ "auto_revoke": true,
+ "show_posts": true,
+ "badge_type_id": 3
+ },
+ {
+ "id": 4,
+ "name": "Leader",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": true,
+ "multiple_grant": false,
+ "icon": "fa-user",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 4,
+ "system": true,
+ "query": "\n SELECT u.id user_id, current_timestamp granted_at FROM users u\n WHERE trust_level >= 4 AND (\n :backfill OR u.id IN (:user_ids)\n )\n",
+ "trigger": 4,
+ "target_posts": false,
+ "auto_revoke": true,
+ "show_posts": false,
+ "badge_type_id": 1
+ },
+ {
+ "id": 3,
+ "name": "Regular",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": true,
+ "multiple_grant": false,
+ "icon": "fa-user",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 4,
+ "system": true,
+ "query": "\n SELECT u.id user_id, current_timestamp granted_at FROM users u\n WHERE trust_level >= 3 AND (\n :backfill OR u.id IN (:user_ids)\n )\n",
+ "trigger": 4,
+ "target_posts": false,
+ "auto_revoke": true,
+ "show_posts": false,
+ "badge_type_id": 2
+ },
+ {
+ "id": 1,
+ "name": "Basic User",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-user",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 4,
+ "system": true,
+ "query": "\n SELECT u.id user_id, current_timestamp granted_at FROM users u\n WHERE trust_level >= 1 AND (\n :backfill OR u.id IN (:user_ids)\n )\n",
+ "trigger": 4,
+ "target_posts": false,
+ "auto_revoke": true,
+ "show_posts": false,
+ "badge_type_id": 3
+ },
+ {
+ "id": 2,
+ "name": "Member",
+ "description": null,
+ "grant_count": 0,
+ "allow_title": false,
+ "multiple_grant": false,
+ "icon": "fa-user",
+ "image": null,
+ "listable": true,
+ "enabled": true,
+ "badge_grouping_id": 4,
+ "system": true,
+ "query": "\n SELECT u.id user_id, current_timestamp granted_at FROM users u\n WHERE trust_level >= 2 AND (\n :backfill OR u.id IN (:user_ids)\n )\n",
+ "trigger": 4,
+ "target_posts": false,
+ "auto_revoke": true,
+ "show_posts": false,
+ "badge_type_id": 3
+ }
+ ],
+ "badge_types": [
+ {
+ "id": 3,
+ "name": "Bronze",
+ "sort_order": 7
+ },
+ {
+ "id": 1,
+ "name": "Gold",
+ "sort_order": 9
+ },
+ {
+ "id": 2,
+ "name": "Silver",
+ "sort_order": 8
+ }
+ ],
+ "badge_groupings": [
+ {
+ "id": 1,
+ "name": "Getting Started",
+ "description": null,
+ "position": 10
+ },
+ {
+ "id": 2,
+ "name": "Community",
+ "description": null,
+ "position": 11
+ },
+ {
+ "id": 3,
+ "name": "Posting",
+ "description": null,
+ "position": 12
+ },
+ {
+ "id": 4,
+ "name": "Trust Level",
+ "description": null,
+ "position": 13
+ },
+ {
+ "id": 5,
+ "name": "Other",
+ "description": null,
+ "position": 14
+ }
+ ],
+ "admin_badges": {
+ "protected_system_fields": [
+ "badge_type_id",
+ "multiple_grant",
+ "target_posts",
+ "show_posts",
+ "query",
+ "trigger",
+ "auto_revoke",
+ "listable"
+ ],
+ "triggers": {
+ "none": 0,
+ "post_action": 1,
+ "post_revision": 2,
+ "trust_level_change": 4,
+ "user_change": 8
+ },
+ "badge_ids": [
+ 9,
+ 11,
+ 14,
+ 15,
+ 12,
+ 16,
+ 17,
+ 23,
+ 22,
+ 10,
+ 13,
+ 21,
+ 5,
+ 8,
+ 20,
+ 7,
+ 19,
+ 6,
+ 18,
+ 4,
+ 3,
+ 1,
+ 2
+ ],
+ "badge_grouping_ids": [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5
+ ],
+ "badge_type_ids": [
+ 1,
+ 2,
+ 3
+ ]
+ }
+}