discourse_api 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +21 -21
- data/.travis.yml +5 -5
- data/CHANGELOG.md +105 -99
- data/Gemfile +4 -4
- data/Guardfile +5 -5
- data/LICENSE.txt +22 -22
- data/README.md +73 -73
- data/Rakefile +7 -7
- data/discourse_api.gemspec +35 -35
- data/examples/backups.rb +18 -18
- data/examples/category.rb +21 -21
- data/examples/change_topic_status.rb +33 -33
- data/examples/create_topic.rb +23 -23
- data/examples/create_user.rb +14 -14
- data/examples/dashboard.rb +13 -13
- data/examples/disposable_invite_tokens.rb +18 -18
- data/examples/example.rb +9 -9
- data/examples/groups.rb +25 -25
- data/examples/invite_users.rb +15 -15
- data/examples/post_action.rb +25 -25
- data/examples/search.rb +9 -9
- data/examples/sso.rb +14 -14
- data/examples/topic_lists.rb +15 -15
- data/examples/update_user.rb +22 -22
- data/lib/discourse_api.rb +5 -5
- data/lib/discourse_api/api/api_key.rb +31 -31
- data/lib/discourse_api/api/backups.rb +24 -24
- data/lib/discourse_api/api/badges.rb +28 -28
- data/lib/discourse_api/api/categories.rb +57 -57
- data/lib/discourse_api/api/dashboard.rb +24 -24
- data/lib/discourse_api/api/email.rb +15 -15
- data/lib/discourse_api/api/groups.rb +52 -52
- data/lib/discourse_api/api/invite.rb +17 -17
- data/lib/discourse_api/api/notifications.rb +9 -9
- data/lib/discourse_api/api/params.rb +55 -55
- data/lib/discourse_api/api/posts.rb +41 -41
- data/lib/discourse_api/api/private_messages.rb +10 -10
- data/lib/discourse_api/api/search.rb +19 -19
- data/lib/discourse_api/api/sso.rb +22 -22
- data/lib/discourse_api/api/tags.rb +10 -10
- data/lib/discourse_api/api/topics.rb +78 -78
- data/lib/discourse_api/api/users.rb +93 -85
- data/lib/discourse_api/client.rb +133 -133
- data/lib/discourse_api/error.rb +17 -17
- data/lib/discourse_api/single_sign_on.rb +110 -110
- data/lib/discourse_api/version.rb +3 -3
- data/routes.txt +203 -203
- data/spec/discourse_api/api/api_key_spec.rb +121 -121
- data/spec/discourse_api/api/backups_spec.rb +23 -23
- data/spec/discourse_api/api/badges_spec.rb +40 -40
- data/spec/discourse_api/api/categories_spec.rb +87 -87
- data/spec/discourse_api/api/email_spec.rb +39 -39
- data/spec/discourse_api/api/groups_spec.rb +94 -94
- data/spec/discourse_api/api/notifications_spec.rb +24 -24
- data/spec/discourse_api/api/params_spec.rb +32 -32
- data/spec/discourse_api/api/posts_spec.rb +41 -41
- data/spec/discourse_api/api/private_messages_spec.rb +22 -22
- data/spec/discourse_api/api/search_spec.rb +30 -30
- data/spec/discourse_api/api/sso_spec.rb +16 -16
- data/spec/discourse_api/api/topics_spec.rb +113 -113
- data/spec/discourse_api/api/users_spec.rb +255 -227
- data/spec/discourse_api/client_spec.rb +115 -115
- data/spec/fixtures/api.json +12 -12
- data/spec/fixtures/backups.json +12 -12
- data/spec/fixtures/badges.json +569 -569
- data/spec/fixtures/categories.json +72 -72
- data/spec/fixtures/category_latest_topics.json +92 -92
- data/spec/fixtures/category_topics.json +91 -91
- data/spec/fixtures/email_list_all.json +749 -749
- data/spec/fixtures/email_settings.json +13 -13
- data/spec/fixtures/generate_api_key.json +12 -12
- data/spec/fixtures/generate_master_key.json +7 -7
- data/spec/fixtures/groups.json +18 -18
- data/spec/fixtures/hot.json +113 -113
- data/spec/fixtures/latest.json +115 -115
- data/spec/fixtures/members_0.json +403 -403
- data/spec/fixtures/members_1.json +363 -363
- data/spec/fixtures/new.json +113 -113
- data/spec/fixtures/notifications.json +16 -16
- data/spec/fixtures/post.json +94 -94
- data/spec/fixtures/post_action_users.json +18 -18
- data/spec/fixtures/private_messages.json +69 -69
- data/spec/fixtures/regenerate_api_key.json +7 -7
- data/spec/fixtures/search.json +24 -24
- data/spec/fixtures/topic.json +739 -739
- data/spec/fixtures/topic_invite_user.json +3 -3
- data/spec/fixtures/topics_created_by.json +49 -49
- data/spec/fixtures/update_trust_level.json +37 -37
- data/spec/fixtures/upload_avatar.json +13 -13
- data/spec/fixtures/user.json +65 -65
- data/spec/fixtures/user_activate_success.json +3 -3
- data/spec/fixtures/user_badges.json +170 -170
- data/spec/fixtures/user_create_success.json +5 -5
- data/spec/fixtures/user_grant_admin.json +37 -37
- data/spec/fixtures/user_list.json +583 -583
- data/spec/fixtures/user_log_out_success.json +3 -3
- data/spec/fixtures/user_update_avatar_success.json +3 -3
- data/spec/fixtures/user_update_user.json +3 -3
- data/spec/fixtures/user_update_username.json +4 -4
- data/spec/spec_helper.rb +61 -61
- metadata +2 -2
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe DiscourseApi::Client do
|
|
4
|
-
subject { DiscourseApi::Client.new('http://localhost:3000') }
|
|
5
|
-
|
|
6
|
-
describe ".new" do
|
|
7
|
-
it "requires a host argument" do
|
|
8
|
-
expect { DiscourseApi::Client.new }.to raise_error ArgumentError
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "defaults api key to nil" do
|
|
12
|
-
expect(subject.api_key).to be_nil
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "defaults api username to nil" do
|
|
16
|
-
expect(subject.api_username).to be_nil
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "accepts an api key argument" do
|
|
20
|
-
client = DiscourseApi::Client.new('http://localhost:3000', 'test')
|
|
21
|
-
expect(client.api_key).to eq('test')
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "accepts an api username argument" do
|
|
25
|
-
client = DiscourseApi::Client.new('http://localhost:3000', 'test', 'test_user')
|
|
26
|
-
expect(client.api_username).to eq('test_user')
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe "#api_key" do
|
|
31
|
-
it "is publically accessible" do
|
|
32
|
-
subject.api_key = "test_d7fd0429940"
|
|
33
|
-
expect(subject.api_key).to eq("test_d7fd0429940")
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe "#api_username" do
|
|
38
|
-
it "is publically accessible" do
|
|
39
|
-
subject.api_username = "test_user"
|
|
40
|
-
expect(subject.api_username).to eq("test_user")
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe "#host" do
|
|
45
|
-
it "is publically readable" do
|
|
46
|
-
expect(subject.host).to eq("http://localhost:3000")
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it "is not publically writeable" do
|
|
50
|
-
expect(subject).not_to respond_to(:host=)
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
describe "#connection" do
|
|
55
|
-
it "looks like a Faraday connection" do
|
|
56
|
-
expect(subject.send(:connection)).to respond_to :run_request
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it "memorizes the connection" do
|
|
60
|
-
c1, c2 = subject.send(:connection), subject.send(:connection)
|
|
61
|
-
expect(c1.object_id).to eq(c2.object_id)
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
describe "#delete" do
|
|
66
|
-
before do
|
|
67
|
-
stub_delete("http://localhost:3000/test/delete?api_key=test_d7fd0429940&api_username=test_user").with(query: { deleted: "object" })
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
it "allows custom delete requests" do
|
|
71
|
-
subject.api_key = 'test_d7fd0429940'
|
|
72
|
-
subject.api_username = 'test_user'
|
|
73
|
-
subject.delete("/test/delete", { deleted: "object" })
|
|
74
|
-
expect(a_delete("http://localhost:3000/test/delete?api_key=test_d7fd0429940&api_username=test_user").with(query: { deleted: "object" })).to have_been_made
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
describe "#post" do
|
|
79
|
-
before do
|
|
80
|
-
stub_post("http://localhost:3000/test/post?api_key=test_d7fd0429940&api_username=test_user").with(body: { created: "object"})
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
it "allows custom post requests" do
|
|
84
|
-
subject.api_key = 'test_d7fd0429940'
|
|
85
|
-
subject.api_username = 'test_user'
|
|
86
|
-
subject.post("/test/post", { created: "object" })
|
|
87
|
-
expect(a_post("http://localhost:3000/test/post?api_key=test_d7fd0429940&api_username=test_user").with(body: { created: "object"})).to have_been_made
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
describe "#put" do
|
|
92
|
-
before do
|
|
93
|
-
stub_put("http://localhost:3000/test/put?api_key=test_d7fd0429940&api_username=test_user").with(body: { updated: "object" })
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
it "allows custom put requests" do
|
|
97
|
-
subject.api_key = 'test_d7fd0429940'
|
|
98
|
-
subject.api_username = 'test_user'
|
|
99
|
-
subject.put("/test/put", { updated: "object" })
|
|
100
|
-
expect(a_put("http://localhost:3000/test/put?api_key=test_d7fd0429940&api_username=test_user").with(body: { updated: "object" })).to have_been_made
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
describe "#request" do
|
|
105
|
-
it "catches Faraday errors" do
|
|
106
|
-
allow(subject).to receive(:connection).and_raise(Faraday::Error::ClientError.new("BOOM!"))
|
|
107
|
-
expect{subject.send(:request, :get, "/test")}.to raise_error DiscourseApi::Error
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it "catches JSON::ParserError errors" do
|
|
111
|
-
allow(subject).to receive(:connection).and_raise(JSON::ParserError.new("unexpected token"))
|
|
112
|
-
expect{subject.send(:request, :get, "/test")}.to raise_error DiscourseApi::Error
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
end
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe DiscourseApi::Client do
|
|
4
|
+
subject { DiscourseApi::Client.new('http://localhost:3000') }
|
|
5
|
+
|
|
6
|
+
describe ".new" do
|
|
7
|
+
it "requires a host argument" do
|
|
8
|
+
expect { DiscourseApi::Client.new }.to raise_error ArgumentError
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "defaults api key to nil" do
|
|
12
|
+
expect(subject.api_key).to be_nil
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "defaults api username to nil" do
|
|
16
|
+
expect(subject.api_username).to be_nil
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "accepts an api key argument" do
|
|
20
|
+
client = DiscourseApi::Client.new('http://localhost:3000', 'test')
|
|
21
|
+
expect(client.api_key).to eq('test')
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "accepts an api username argument" do
|
|
25
|
+
client = DiscourseApi::Client.new('http://localhost:3000', 'test', 'test_user')
|
|
26
|
+
expect(client.api_username).to eq('test_user')
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe "#api_key" do
|
|
31
|
+
it "is publically accessible" do
|
|
32
|
+
subject.api_key = "test_d7fd0429940"
|
|
33
|
+
expect(subject.api_key).to eq("test_d7fd0429940")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe "#api_username" do
|
|
38
|
+
it "is publically accessible" do
|
|
39
|
+
subject.api_username = "test_user"
|
|
40
|
+
expect(subject.api_username).to eq("test_user")
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
describe "#host" do
|
|
45
|
+
it "is publically readable" do
|
|
46
|
+
expect(subject.host).to eq("http://localhost:3000")
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "is not publically writeable" do
|
|
50
|
+
expect(subject).not_to respond_to(:host=)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe "#connection" do
|
|
55
|
+
it "looks like a Faraday connection" do
|
|
56
|
+
expect(subject.send(:connection)).to respond_to :run_request
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "memorizes the connection" do
|
|
60
|
+
c1, c2 = subject.send(:connection), subject.send(:connection)
|
|
61
|
+
expect(c1.object_id).to eq(c2.object_id)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe "#delete" do
|
|
66
|
+
before do
|
|
67
|
+
stub_delete("http://localhost:3000/test/delete?api_key=test_d7fd0429940&api_username=test_user").with(query: { deleted: "object" })
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "allows custom delete requests" do
|
|
71
|
+
subject.api_key = 'test_d7fd0429940'
|
|
72
|
+
subject.api_username = 'test_user'
|
|
73
|
+
subject.delete("/test/delete", { deleted: "object" })
|
|
74
|
+
expect(a_delete("http://localhost:3000/test/delete?api_key=test_d7fd0429940&api_username=test_user").with(query: { deleted: "object" })).to have_been_made
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
describe "#post" do
|
|
79
|
+
before do
|
|
80
|
+
stub_post("http://localhost:3000/test/post?api_key=test_d7fd0429940&api_username=test_user").with(body: { created: "object"})
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "allows custom post requests" do
|
|
84
|
+
subject.api_key = 'test_d7fd0429940'
|
|
85
|
+
subject.api_username = 'test_user'
|
|
86
|
+
subject.post("/test/post", { created: "object" })
|
|
87
|
+
expect(a_post("http://localhost:3000/test/post?api_key=test_d7fd0429940&api_username=test_user").with(body: { created: "object"})).to have_been_made
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
describe "#put" do
|
|
92
|
+
before do
|
|
93
|
+
stub_put("http://localhost:3000/test/put?api_key=test_d7fd0429940&api_username=test_user").with(body: { updated: "object" })
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it "allows custom put requests" do
|
|
97
|
+
subject.api_key = 'test_d7fd0429940'
|
|
98
|
+
subject.api_username = 'test_user'
|
|
99
|
+
subject.put("/test/put", { updated: "object" })
|
|
100
|
+
expect(a_put("http://localhost:3000/test/put?api_key=test_d7fd0429940&api_username=test_user").with(body: { updated: "object" })).to have_been_made
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
describe "#request" do
|
|
105
|
+
it "catches Faraday errors" do
|
|
106
|
+
allow(subject).to receive(:connection).and_raise(Faraday::Error::ClientError.new("BOOM!"))
|
|
107
|
+
expect{subject.send(:request, :get, "/test")}.to raise_error DiscourseApi::Error
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it "catches JSON::ParserError errors" do
|
|
111
|
+
allow(subject).to receive(:connection).and_raise(JSON::ParserError.new("unexpected token"))
|
|
112
|
+
expect{subject.send(:request, :get, "/test")}.to raise_error DiscourseApi::Error
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
data/spec/fixtures/api.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": 1,
|
|
4
|
-
"key": "test_d7fd0429940",
|
|
5
|
-
"user": {
|
|
6
|
-
"id": 1,
|
|
7
|
-
"username": "test_user",
|
|
8
|
-
"uploaded_avatar_id": 7,
|
|
9
|
-
"avatar_template": "/user_avatar/localhost/test_user/{size}/7.png"
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
]
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"key": "test_d7fd0429940",
|
|
5
|
+
"user": {
|
|
6
|
+
"id": 1,
|
|
7
|
+
"username": "test_user",
|
|
8
|
+
"uploaded_avatar_id": 7,
|
|
9
|
+
"avatar_template": "/user_avatar/localhost/test_user/{size}/7.png"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
]
|
data/spec/fixtures/backups.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"filename": "discourse-2015-01-10-065015.tar.gz",
|
|
4
|
-
"size": 557075,
|
|
5
|
-
"link": "//localhost:3000/admin/backups/discourse-2015-01-10-065015.tar.gz"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"filename": "2014-02-10-065935.tar.gz",
|
|
9
|
-
"size": 5,
|
|
10
|
-
"link": "//localhost:3000/admin/backups/2014-02-10-065935.tar.gz"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"filename": "discourse-2015-01-10-065015.tar.gz",
|
|
4
|
+
"size": 557075,
|
|
5
|
+
"link": "//localhost:3000/admin/backups/discourse-2015-01-10-065015.tar.gz"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"filename": "2014-02-10-065935.tar.gz",
|
|
9
|
+
"size": 5,
|
|
10
|
+
"link": "//localhost:3000/admin/backups/2014-02-10-065935.tar.gz"
|
|
11
|
+
}
|
|
12
|
+
]
|
data/spec/fixtures/badges.json
CHANGED
|
@@ -1,569 +1,569 @@
|
|
|
1
|
-
{
|
|
2
|
-
"badges": [
|
|
3
|
-
{
|
|
4
|
-
"id": 9,
|
|
5
|
-
"name": "Autobiographer",
|
|
6
|
-
"description": null,
|
|
7
|
-
"grant_count": 0,
|
|
8
|
-
"allow_title": false,
|
|
9
|
-
"multiple_grant": false,
|
|
10
|
-
"icon": "fa-certificate",
|
|
11
|
-
"image": null,
|
|
12
|
-
"listable": true,
|
|
13
|
-
"enabled": true,
|
|
14
|
-
"badge_grouping_id": 1,
|
|
15
|
-
"system": true,
|
|
16
|
-
"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",
|
|
17
|
-
"trigger": 8,
|
|
18
|
-
"target_posts": false,
|
|
19
|
-
"auto_revoke": true,
|
|
20
|
-
"show_posts": false,
|
|
21
|
-
"badge_type_id": 3
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"id": 11,
|
|
25
|
-
"name": "First Like",
|
|
26
|
-
"description": null,
|
|
27
|
-
"grant_count": 1,
|
|
28
|
-
"allow_title": false,
|
|
29
|
-
"multiple_grant": false,
|
|
30
|
-
"icon": "fa-certificate",
|
|
31
|
-
"image": null,
|
|
32
|
-
"listable": true,
|
|
33
|
-
"enabled": true,
|
|
34
|
-
"badge_grouping_id": 1,
|
|
35
|
-
"system": true,
|
|
36
|
-
"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",
|
|
37
|
-
"trigger": 1,
|
|
38
|
-
"target_posts": true,
|
|
39
|
-
"auto_revoke": true,
|
|
40
|
-
"show_posts": true,
|
|
41
|
-
"badge_type_id": 3
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"id": 14,
|
|
45
|
-
"name": "First Link",
|
|
46
|
-
"description": null,
|
|
47
|
-
"grant_count": 0,
|
|
48
|
-
"allow_title": false,
|
|
49
|
-
"multiple_grant": false,
|
|
50
|
-
"icon": "fa-certificate",
|
|
51
|
-
"image": null,
|
|
52
|
-
"listable": true,
|
|
53
|
-
"enabled": true,
|
|
54
|
-
"badge_grouping_id": 1,
|
|
55
|
-
"system": true,
|
|
56
|
-
"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",
|
|
57
|
-
"trigger": 2,
|
|
58
|
-
"target_posts": true,
|
|
59
|
-
"auto_revoke": true,
|
|
60
|
-
"show_posts": true,
|
|
61
|
-
"badge_type_id": 3
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"id": 15,
|
|
65
|
-
"name": "First Quote",
|
|
66
|
-
"description": null,
|
|
67
|
-
"grant_count": 0,
|
|
68
|
-
"allow_title": false,
|
|
69
|
-
"multiple_grant": false,
|
|
70
|
-
"icon": "fa-certificate",
|
|
71
|
-
"image": null,
|
|
72
|
-
"listable": true,
|
|
73
|
-
"enabled": true,
|
|
74
|
-
"badge_grouping_id": 1,
|
|
75
|
-
"system": true,
|
|
76
|
-
"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",
|
|
77
|
-
"trigger": 2,
|
|
78
|
-
"target_posts": true,
|
|
79
|
-
"auto_revoke": true,
|
|
80
|
-
"show_posts": true,
|
|
81
|
-
"badge_type_id": 3
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"id": 12,
|
|
85
|
-
"name": "First Share",
|
|
86
|
-
"description": null,
|
|
87
|
-
"grant_count": 0,
|
|
88
|
-
"allow_title": false,
|
|
89
|
-
"multiple_grant": false,
|
|
90
|
-
"icon": "fa-certificate",
|
|
91
|
-
"image": null,
|
|
92
|
-
"listable": true,
|
|
93
|
-
"enabled": true,
|
|
94
|
-
"badge_grouping_id": 1,
|
|
95
|
-
"system": true,
|
|
96
|
-
"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",
|
|
97
|
-
"trigger": 0,
|
|
98
|
-
"target_posts": true,
|
|
99
|
-
"auto_revoke": true,
|
|
100
|
-
"show_posts": true,
|
|
101
|
-
"badge_type_id": 3
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"id": 16,
|
|
105
|
-
"name": "Read Guidelines",
|
|
106
|
-
"description": null,
|
|
107
|
-
"grant_count": 0,
|
|
108
|
-
"allow_title": false,
|
|
109
|
-
"multiple_grant": false,
|
|
110
|
-
"icon": "fa-certificate",
|
|
111
|
-
"image": null,
|
|
112
|
-
"listable": true,
|
|
113
|
-
"enabled": true,
|
|
114
|
-
"badge_grouping_id": 1,
|
|
115
|
-
"system": true,
|
|
116
|
-
"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",
|
|
117
|
-
"trigger": 8,
|
|
118
|
-
"target_posts": false,
|
|
119
|
-
"auto_revoke": true,
|
|
120
|
-
"show_posts": false,
|
|
121
|
-
"badge_type_id": 3
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"id": 17,
|
|
125
|
-
"name": "Reader",
|
|
126
|
-
"description": null,
|
|
127
|
-
"grant_count": 0,
|
|
128
|
-
"allow_title": false,
|
|
129
|
-
"multiple_grant": false,
|
|
130
|
-
"icon": "fa-certificate",
|
|
131
|
-
"image": null,
|
|
132
|
-
"listable": true,
|
|
133
|
-
"enabled": true,
|
|
134
|
-
"badge_grouping_id": 1,
|
|
135
|
-
"system": true,
|
|
136
|
-
"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",
|
|
137
|
-
"trigger": null,
|
|
138
|
-
"target_posts": false,
|
|
139
|
-
"auto_revoke": false,
|
|
140
|
-
"show_posts": false,
|
|
141
|
-
"badge_type_id": 3
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"id": 23,
|
|
145
|
-
"name": "Great Share",
|
|
146
|
-
"description": null,
|
|
147
|
-
"grant_count": 0,
|
|
148
|
-
"allow_title": false,
|
|
149
|
-
"multiple_grant": true,
|
|
150
|
-
"icon": "fa-certificate",
|
|
151
|
-
"image": null,
|
|
152
|
-
"listable": true,
|
|
153
|
-
"enabled": true,
|
|
154
|
-
"badge_grouping_id": 2,
|
|
155
|
-
"system": true,
|
|
156
|
-
"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",
|
|
157
|
-
"trigger": 0,
|
|
158
|
-
"target_posts": true,
|
|
159
|
-
"auto_revoke": true,
|
|
160
|
-
"show_posts": true,
|
|
161
|
-
"badge_type_id": 1
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"id": 22,
|
|
165
|
-
"name": "Good Share",
|
|
166
|
-
"description": null,
|
|
167
|
-
"grant_count": 0,
|
|
168
|
-
"allow_title": false,
|
|
169
|
-
"multiple_grant": true,
|
|
170
|
-
"icon": "fa-certificate",
|
|
171
|
-
"image": null,
|
|
172
|
-
"listable": true,
|
|
173
|
-
"enabled": true,
|
|
174
|
-
"badge_grouping_id": 2,
|
|
175
|
-
"system": true,
|
|
176
|
-
"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",
|
|
177
|
-
"trigger": 0,
|
|
178
|
-
"target_posts": true,
|
|
179
|
-
"auto_revoke": true,
|
|
180
|
-
"show_posts": true,
|
|
181
|
-
"badge_type_id": 2
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
"id": 10,
|
|
185
|
-
"name": "Editor",
|
|
186
|
-
"description": null,
|
|
187
|
-
"grant_count": 1,
|
|
188
|
-
"allow_title": false,
|
|
189
|
-
"multiple_grant": false,
|
|
190
|
-
"icon": "fa-certificate",
|
|
191
|
-
"image": null,
|
|
192
|
-
"listable": true,
|
|
193
|
-
"enabled": true,
|
|
194
|
-
"badge_grouping_id": 2,
|
|
195
|
-
"system": true,
|
|
196
|
-
"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",
|
|
197
|
-
"trigger": 2,
|
|
198
|
-
"target_posts": false,
|
|
199
|
-
"auto_revoke": true,
|
|
200
|
-
"show_posts": false,
|
|
201
|
-
"badge_type_id": 3
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"id": 13,
|
|
205
|
-
"name": "First Flag",
|
|
206
|
-
"description": null,
|
|
207
|
-
"grant_count": 0,
|
|
208
|
-
"allow_title": false,
|
|
209
|
-
"multiple_grant": false,
|
|
210
|
-
"icon": "fa-certificate",
|
|
211
|
-
"image": null,
|
|
212
|
-
"listable": true,
|
|
213
|
-
"enabled": true,
|
|
214
|
-
"badge_grouping_id": 2,
|
|
215
|
-
"system": true,
|
|
216
|
-
"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",
|
|
217
|
-
"trigger": 1,
|
|
218
|
-
"target_posts": true,
|
|
219
|
-
"auto_revoke": false,
|
|
220
|
-
"show_posts": false,
|
|
221
|
-
"badge_type_id": 3
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
"id": 21,
|
|
225
|
-
"name": "Nice Share",
|
|
226
|
-
"description": null,
|
|
227
|
-
"grant_count": 0,
|
|
228
|
-
"allow_title": false,
|
|
229
|
-
"multiple_grant": true,
|
|
230
|
-
"icon": "fa-certificate",
|
|
231
|
-
"image": null,
|
|
232
|
-
"listable": true,
|
|
233
|
-
"enabled": true,
|
|
234
|
-
"badge_grouping_id": 2,
|
|
235
|
-
"system": true,
|
|
236
|
-
"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",
|
|
237
|
-
"trigger": 0,
|
|
238
|
-
"target_posts": true,
|
|
239
|
-
"auto_revoke": true,
|
|
240
|
-
"show_posts": true,
|
|
241
|
-
"badge_type_id": 3
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
"id": 5,
|
|
245
|
-
"name": "Welcome",
|
|
246
|
-
"description": null,
|
|
247
|
-
"grant_count": 1,
|
|
248
|
-
"allow_title": false,
|
|
249
|
-
"multiple_grant": false,
|
|
250
|
-
"icon": "fa-certificate",
|
|
251
|
-
"image": null,
|
|
252
|
-
"listable": true,
|
|
253
|
-
"enabled": true,
|
|
254
|
-
"badge_grouping_id": 2,
|
|
255
|
-
"system": true,
|
|
256
|
-
"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",
|
|
257
|
-
"trigger": 1,
|
|
258
|
-
"target_posts": true,
|
|
259
|
-
"auto_revoke": true,
|
|
260
|
-
"show_posts": true,
|
|
261
|
-
"badge_type_id": 3
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
"id": 8,
|
|
265
|
-
"name": "Great Post",
|
|
266
|
-
"description": null,
|
|
267
|
-
"grant_count": 0,
|
|
268
|
-
"allow_title": false,
|
|
269
|
-
"multiple_grant": true,
|
|
270
|
-
"icon": "fa-certificate",
|
|
271
|
-
"image": null,
|
|
272
|
-
"listable": true,
|
|
273
|
-
"enabled": true,
|
|
274
|
-
"badge_grouping_id": 3,
|
|
275
|
-
"system": true,
|
|
276
|
-
"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",
|
|
277
|
-
"trigger": 1,
|
|
278
|
-
"target_posts": true,
|
|
279
|
-
"auto_revoke": true,
|
|
280
|
-
"show_posts": true,
|
|
281
|
-
"badge_type_id": 1
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"id": 20,
|
|
285
|
-
"name": "Great Topic",
|
|
286
|
-
"description": null,
|
|
287
|
-
"grant_count": 0,
|
|
288
|
-
"allow_title": false,
|
|
289
|
-
"multiple_grant": true,
|
|
290
|
-
"icon": "fa-certificate",
|
|
291
|
-
"image": null,
|
|
292
|
-
"listable": true,
|
|
293
|
-
"enabled": true,
|
|
294
|
-
"badge_grouping_id": 3,
|
|
295
|
-
"system": true,
|
|
296
|
-
"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",
|
|
297
|
-
"trigger": 1,
|
|
298
|
-
"target_posts": true,
|
|
299
|
-
"auto_revoke": true,
|
|
300
|
-
"show_posts": true,
|
|
301
|
-
"badge_type_id": 1
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
"id": 7,
|
|
305
|
-
"name": "Good Post",
|
|
306
|
-
"description": null,
|
|
307
|
-
"grant_count": 0,
|
|
308
|
-
"allow_title": false,
|
|
309
|
-
"multiple_grant": true,
|
|
310
|
-
"icon": "fa-certificate",
|
|
311
|
-
"image": null,
|
|
312
|
-
"listable": true,
|
|
313
|
-
"enabled": true,
|
|
314
|
-
"badge_grouping_id": 3,
|
|
315
|
-
"system": true,
|
|
316
|
-
"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",
|
|
317
|
-
"trigger": 1,
|
|
318
|
-
"target_posts": true,
|
|
319
|
-
"auto_revoke": true,
|
|
320
|
-
"show_posts": true,
|
|
321
|
-
"badge_type_id": 2
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
"id": 19,
|
|
325
|
-
"name": "Good Topic",
|
|
326
|
-
"description": null,
|
|
327
|
-
"grant_count": 0,
|
|
328
|
-
"allow_title": false,
|
|
329
|
-
"multiple_grant": true,
|
|
330
|
-
"icon": "fa-certificate",
|
|
331
|
-
"image": null,
|
|
332
|
-
"listable": true,
|
|
333
|
-
"enabled": true,
|
|
334
|
-
"badge_grouping_id": 3,
|
|
335
|
-
"system": true,
|
|
336
|
-
"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",
|
|
337
|
-
"trigger": 1,
|
|
338
|
-
"target_posts": true,
|
|
339
|
-
"auto_revoke": true,
|
|
340
|
-
"show_posts": true,
|
|
341
|
-
"badge_type_id": 2
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
"id": 6,
|
|
345
|
-
"name": "Nice Post",
|
|
346
|
-
"description": null,
|
|
347
|
-
"grant_count": 0,
|
|
348
|
-
"allow_title": false,
|
|
349
|
-
"multiple_grant": true,
|
|
350
|
-
"icon": "fa-certificate",
|
|
351
|
-
"image": null,
|
|
352
|
-
"listable": true,
|
|
353
|
-
"enabled": true,
|
|
354
|
-
"badge_grouping_id": 3,
|
|
355
|
-
"system": true,
|
|
356
|
-
"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",
|
|
357
|
-
"trigger": 1,
|
|
358
|
-
"target_posts": true,
|
|
359
|
-
"auto_revoke": true,
|
|
360
|
-
"show_posts": true,
|
|
361
|
-
"badge_type_id": 3
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
"id": 18,
|
|
365
|
-
"name": "Nice Topic",
|
|
366
|
-
"description": null,
|
|
367
|
-
"grant_count": 0,
|
|
368
|
-
"allow_title": false,
|
|
369
|
-
"multiple_grant": true,
|
|
370
|
-
"icon": "fa-certificate",
|
|
371
|
-
"image": null,
|
|
372
|
-
"listable": true,
|
|
373
|
-
"enabled": true,
|
|
374
|
-
"badge_grouping_id": 3,
|
|
375
|
-
"system": true,
|
|
376
|
-
"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",
|
|
377
|
-
"trigger": 1,
|
|
378
|
-
"target_posts": true,
|
|
379
|
-
"auto_revoke": true,
|
|
380
|
-
"show_posts": true,
|
|
381
|
-
"badge_type_id": 3
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
"id": 4,
|
|
385
|
-
"name": "Leader",
|
|
386
|
-
"description": null,
|
|
387
|
-
"grant_count": 0,
|
|
388
|
-
"allow_title": true,
|
|
389
|
-
"multiple_grant": false,
|
|
390
|
-
"icon": "fa-user",
|
|
391
|
-
"image": null,
|
|
392
|
-
"listable": true,
|
|
393
|
-
"enabled": true,
|
|
394
|
-
"badge_grouping_id": 4,
|
|
395
|
-
"system": true,
|
|
396
|
-
"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",
|
|
397
|
-
"trigger": 4,
|
|
398
|
-
"target_posts": false,
|
|
399
|
-
"auto_revoke": true,
|
|
400
|
-
"show_posts": false,
|
|
401
|
-
"badge_type_id": 1
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
"id": 3,
|
|
405
|
-
"name": "Regular",
|
|
406
|
-
"description": null,
|
|
407
|
-
"grant_count": 0,
|
|
408
|
-
"allow_title": true,
|
|
409
|
-
"multiple_grant": false,
|
|
410
|
-
"icon": "fa-user",
|
|
411
|
-
"image": null,
|
|
412
|
-
"listable": true,
|
|
413
|
-
"enabled": true,
|
|
414
|
-
"badge_grouping_id": 4,
|
|
415
|
-
"system": true,
|
|
416
|
-
"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",
|
|
417
|
-
"trigger": 4,
|
|
418
|
-
"target_posts": false,
|
|
419
|
-
"auto_revoke": true,
|
|
420
|
-
"show_posts": false,
|
|
421
|
-
"badge_type_id": 2
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
"id": 1,
|
|
425
|
-
"name": "Basic User",
|
|
426
|
-
"description": null,
|
|
427
|
-
"grant_count": 0,
|
|
428
|
-
"allow_title": false,
|
|
429
|
-
"multiple_grant": false,
|
|
430
|
-
"icon": "fa-user",
|
|
431
|
-
"image": null,
|
|
432
|
-
"listable": true,
|
|
433
|
-
"enabled": true,
|
|
434
|
-
"badge_grouping_id": 4,
|
|
435
|
-
"system": true,
|
|
436
|
-
"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",
|
|
437
|
-
"trigger": 4,
|
|
438
|
-
"target_posts": false,
|
|
439
|
-
"auto_revoke": true,
|
|
440
|
-
"show_posts": false,
|
|
441
|
-
"badge_type_id": 3
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
"id": 2,
|
|
445
|
-
"name": "Member",
|
|
446
|
-
"description": null,
|
|
447
|
-
"grant_count": 0,
|
|
448
|
-
"allow_title": false,
|
|
449
|
-
"multiple_grant": false,
|
|
450
|
-
"icon": "fa-user",
|
|
451
|
-
"image": null,
|
|
452
|
-
"listable": true,
|
|
453
|
-
"enabled": true,
|
|
454
|
-
"badge_grouping_id": 4,
|
|
455
|
-
"system": true,
|
|
456
|
-
"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",
|
|
457
|
-
"trigger": 4,
|
|
458
|
-
"target_posts": false,
|
|
459
|
-
"auto_revoke": true,
|
|
460
|
-
"show_posts": false,
|
|
461
|
-
"badge_type_id": 3
|
|
462
|
-
}
|
|
463
|
-
],
|
|
464
|
-
"badge_types": [
|
|
465
|
-
{
|
|
466
|
-
"id": 3,
|
|
467
|
-
"name": "Bronze",
|
|
468
|
-
"sort_order": 7
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
"id": 1,
|
|
472
|
-
"name": "Gold",
|
|
473
|
-
"sort_order": 9
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
"id": 2,
|
|
477
|
-
"name": "Silver",
|
|
478
|
-
"sort_order": 8
|
|
479
|
-
}
|
|
480
|
-
],
|
|
481
|
-
"badge_groupings": [
|
|
482
|
-
{
|
|
483
|
-
"id": 1,
|
|
484
|
-
"name": "Getting Started",
|
|
485
|
-
"description": null,
|
|
486
|
-
"position": 10
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
"id": 2,
|
|
490
|
-
"name": "Community",
|
|
491
|
-
"description": null,
|
|
492
|
-
"position": 11
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
"id": 3,
|
|
496
|
-
"name": "Posting",
|
|
497
|
-
"description": null,
|
|
498
|
-
"position": 12
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
"id": 4,
|
|
502
|
-
"name": "Trust Level",
|
|
503
|
-
"description": null,
|
|
504
|
-
"position": 13
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
"id": 5,
|
|
508
|
-
"name": "Other",
|
|
509
|
-
"description": null,
|
|
510
|
-
"position": 14
|
|
511
|
-
}
|
|
512
|
-
],
|
|
513
|
-
"admin_badges": {
|
|
514
|
-
"protected_system_fields": [
|
|
515
|
-
"badge_type_id",
|
|
516
|
-
"multiple_grant",
|
|
517
|
-
"target_posts",
|
|
518
|
-
"show_posts",
|
|
519
|
-
"query",
|
|
520
|
-
"trigger",
|
|
521
|
-
"auto_revoke",
|
|
522
|
-
"listable"
|
|
523
|
-
],
|
|
524
|
-
"triggers": {
|
|
525
|
-
"none": 0,
|
|
526
|
-
"post_action": 1,
|
|
527
|
-
"post_revision": 2,
|
|
528
|
-
"trust_level_change": 4,
|
|
529
|
-
"user_change": 8
|
|
530
|
-
},
|
|
531
|
-
"badge_ids": [
|
|
532
|
-
9,
|
|
533
|
-
11,
|
|
534
|
-
14,
|
|
535
|
-
15,
|
|
536
|
-
12,
|
|
537
|
-
16,
|
|
538
|
-
17,
|
|
539
|
-
23,
|
|
540
|
-
22,
|
|
541
|
-
10,
|
|
542
|
-
13,
|
|
543
|
-
21,
|
|
544
|
-
5,
|
|
545
|
-
8,
|
|
546
|
-
20,
|
|
547
|
-
7,
|
|
548
|
-
19,
|
|
549
|
-
6,
|
|
550
|
-
18,
|
|
551
|
-
4,
|
|
552
|
-
3,
|
|
553
|
-
1,
|
|
554
|
-
2
|
|
555
|
-
],
|
|
556
|
-
"badge_grouping_ids": [
|
|
557
|
-
1,
|
|
558
|
-
2,
|
|
559
|
-
3,
|
|
560
|
-
4,
|
|
561
|
-
5
|
|
562
|
-
],
|
|
563
|
-
"badge_type_ids": [
|
|
564
|
-
1,
|
|
565
|
-
2,
|
|
566
|
-
3
|
|
567
|
-
]
|
|
568
|
-
}
|
|
569
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"badges": [
|
|
3
|
+
{
|
|
4
|
+
"id": 9,
|
|
5
|
+
"name": "Autobiographer",
|
|
6
|
+
"description": null,
|
|
7
|
+
"grant_count": 0,
|
|
8
|
+
"allow_title": false,
|
|
9
|
+
"multiple_grant": false,
|
|
10
|
+
"icon": "fa-certificate",
|
|
11
|
+
"image": null,
|
|
12
|
+
"listable": true,
|
|
13
|
+
"enabled": true,
|
|
14
|
+
"badge_grouping_id": 1,
|
|
15
|
+
"system": true,
|
|
16
|
+
"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",
|
|
17
|
+
"trigger": 8,
|
|
18
|
+
"target_posts": false,
|
|
19
|
+
"auto_revoke": true,
|
|
20
|
+
"show_posts": false,
|
|
21
|
+
"badge_type_id": 3
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": 11,
|
|
25
|
+
"name": "First Like",
|
|
26
|
+
"description": null,
|
|
27
|
+
"grant_count": 1,
|
|
28
|
+
"allow_title": false,
|
|
29
|
+
"multiple_grant": false,
|
|
30
|
+
"icon": "fa-certificate",
|
|
31
|
+
"image": null,
|
|
32
|
+
"listable": true,
|
|
33
|
+
"enabled": true,
|
|
34
|
+
"badge_grouping_id": 1,
|
|
35
|
+
"system": true,
|
|
36
|
+
"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",
|
|
37
|
+
"trigger": 1,
|
|
38
|
+
"target_posts": true,
|
|
39
|
+
"auto_revoke": true,
|
|
40
|
+
"show_posts": true,
|
|
41
|
+
"badge_type_id": 3
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": 14,
|
|
45
|
+
"name": "First Link",
|
|
46
|
+
"description": null,
|
|
47
|
+
"grant_count": 0,
|
|
48
|
+
"allow_title": false,
|
|
49
|
+
"multiple_grant": false,
|
|
50
|
+
"icon": "fa-certificate",
|
|
51
|
+
"image": null,
|
|
52
|
+
"listable": true,
|
|
53
|
+
"enabled": true,
|
|
54
|
+
"badge_grouping_id": 1,
|
|
55
|
+
"system": true,
|
|
56
|
+
"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",
|
|
57
|
+
"trigger": 2,
|
|
58
|
+
"target_posts": true,
|
|
59
|
+
"auto_revoke": true,
|
|
60
|
+
"show_posts": true,
|
|
61
|
+
"badge_type_id": 3
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"id": 15,
|
|
65
|
+
"name": "First Quote",
|
|
66
|
+
"description": null,
|
|
67
|
+
"grant_count": 0,
|
|
68
|
+
"allow_title": false,
|
|
69
|
+
"multiple_grant": false,
|
|
70
|
+
"icon": "fa-certificate",
|
|
71
|
+
"image": null,
|
|
72
|
+
"listable": true,
|
|
73
|
+
"enabled": true,
|
|
74
|
+
"badge_grouping_id": 1,
|
|
75
|
+
"system": true,
|
|
76
|
+
"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",
|
|
77
|
+
"trigger": 2,
|
|
78
|
+
"target_posts": true,
|
|
79
|
+
"auto_revoke": true,
|
|
80
|
+
"show_posts": true,
|
|
81
|
+
"badge_type_id": 3
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": 12,
|
|
85
|
+
"name": "First Share",
|
|
86
|
+
"description": null,
|
|
87
|
+
"grant_count": 0,
|
|
88
|
+
"allow_title": false,
|
|
89
|
+
"multiple_grant": false,
|
|
90
|
+
"icon": "fa-certificate",
|
|
91
|
+
"image": null,
|
|
92
|
+
"listable": true,
|
|
93
|
+
"enabled": true,
|
|
94
|
+
"badge_grouping_id": 1,
|
|
95
|
+
"system": true,
|
|
96
|
+
"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",
|
|
97
|
+
"trigger": 0,
|
|
98
|
+
"target_posts": true,
|
|
99
|
+
"auto_revoke": true,
|
|
100
|
+
"show_posts": true,
|
|
101
|
+
"badge_type_id": 3
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": 16,
|
|
105
|
+
"name": "Read Guidelines",
|
|
106
|
+
"description": null,
|
|
107
|
+
"grant_count": 0,
|
|
108
|
+
"allow_title": false,
|
|
109
|
+
"multiple_grant": false,
|
|
110
|
+
"icon": "fa-certificate",
|
|
111
|
+
"image": null,
|
|
112
|
+
"listable": true,
|
|
113
|
+
"enabled": true,
|
|
114
|
+
"badge_grouping_id": 1,
|
|
115
|
+
"system": true,
|
|
116
|
+
"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",
|
|
117
|
+
"trigger": 8,
|
|
118
|
+
"target_posts": false,
|
|
119
|
+
"auto_revoke": true,
|
|
120
|
+
"show_posts": false,
|
|
121
|
+
"badge_type_id": 3
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": 17,
|
|
125
|
+
"name": "Reader",
|
|
126
|
+
"description": null,
|
|
127
|
+
"grant_count": 0,
|
|
128
|
+
"allow_title": false,
|
|
129
|
+
"multiple_grant": false,
|
|
130
|
+
"icon": "fa-certificate",
|
|
131
|
+
"image": null,
|
|
132
|
+
"listable": true,
|
|
133
|
+
"enabled": true,
|
|
134
|
+
"badge_grouping_id": 1,
|
|
135
|
+
"system": true,
|
|
136
|
+
"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",
|
|
137
|
+
"trigger": null,
|
|
138
|
+
"target_posts": false,
|
|
139
|
+
"auto_revoke": false,
|
|
140
|
+
"show_posts": false,
|
|
141
|
+
"badge_type_id": 3
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"id": 23,
|
|
145
|
+
"name": "Great Share",
|
|
146
|
+
"description": null,
|
|
147
|
+
"grant_count": 0,
|
|
148
|
+
"allow_title": false,
|
|
149
|
+
"multiple_grant": true,
|
|
150
|
+
"icon": "fa-certificate",
|
|
151
|
+
"image": null,
|
|
152
|
+
"listable": true,
|
|
153
|
+
"enabled": true,
|
|
154
|
+
"badge_grouping_id": 2,
|
|
155
|
+
"system": true,
|
|
156
|
+
"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",
|
|
157
|
+
"trigger": 0,
|
|
158
|
+
"target_posts": true,
|
|
159
|
+
"auto_revoke": true,
|
|
160
|
+
"show_posts": true,
|
|
161
|
+
"badge_type_id": 1
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"id": 22,
|
|
165
|
+
"name": "Good Share",
|
|
166
|
+
"description": null,
|
|
167
|
+
"grant_count": 0,
|
|
168
|
+
"allow_title": false,
|
|
169
|
+
"multiple_grant": true,
|
|
170
|
+
"icon": "fa-certificate",
|
|
171
|
+
"image": null,
|
|
172
|
+
"listable": true,
|
|
173
|
+
"enabled": true,
|
|
174
|
+
"badge_grouping_id": 2,
|
|
175
|
+
"system": true,
|
|
176
|
+
"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",
|
|
177
|
+
"trigger": 0,
|
|
178
|
+
"target_posts": true,
|
|
179
|
+
"auto_revoke": true,
|
|
180
|
+
"show_posts": true,
|
|
181
|
+
"badge_type_id": 2
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"id": 10,
|
|
185
|
+
"name": "Editor",
|
|
186
|
+
"description": null,
|
|
187
|
+
"grant_count": 1,
|
|
188
|
+
"allow_title": false,
|
|
189
|
+
"multiple_grant": false,
|
|
190
|
+
"icon": "fa-certificate",
|
|
191
|
+
"image": null,
|
|
192
|
+
"listable": true,
|
|
193
|
+
"enabled": true,
|
|
194
|
+
"badge_grouping_id": 2,
|
|
195
|
+
"system": true,
|
|
196
|
+
"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",
|
|
197
|
+
"trigger": 2,
|
|
198
|
+
"target_posts": false,
|
|
199
|
+
"auto_revoke": true,
|
|
200
|
+
"show_posts": false,
|
|
201
|
+
"badge_type_id": 3
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"id": 13,
|
|
205
|
+
"name": "First Flag",
|
|
206
|
+
"description": null,
|
|
207
|
+
"grant_count": 0,
|
|
208
|
+
"allow_title": false,
|
|
209
|
+
"multiple_grant": false,
|
|
210
|
+
"icon": "fa-certificate",
|
|
211
|
+
"image": null,
|
|
212
|
+
"listable": true,
|
|
213
|
+
"enabled": true,
|
|
214
|
+
"badge_grouping_id": 2,
|
|
215
|
+
"system": true,
|
|
216
|
+
"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",
|
|
217
|
+
"trigger": 1,
|
|
218
|
+
"target_posts": true,
|
|
219
|
+
"auto_revoke": false,
|
|
220
|
+
"show_posts": false,
|
|
221
|
+
"badge_type_id": 3
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"id": 21,
|
|
225
|
+
"name": "Nice Share",
|
|
226
|
+
"description": null,
|
|
227
|
+
"grant_count": 0,
|
|
228
|
+
"allow_title": false,
|
|
229
|
+
"multiple_grant": true,
|
|
230
|
+
"icon": "fa-certificate",
|
|
231
|
+
"image": null,
|
|
232
|
+
"listable": true,
|
|
233
|
+
"enabled": true,
|
|
234
|
+
"badge_grouping_id": 2,
|
|
235
|
+
"system": true,
|
|
236
|
+
"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",
|
|
237
|
+
"trigger": 0,
|
|
238
|
+
"target_posts": true,
|
|
239
|
+
"auto_revoke": true,
|
|
240
|
+
"show_posts": true,
|
|
241
|
+
"badge_type_id": 3
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"id": 5,
|
|
245
|
+
"name": "Welcome",
|
|
246
|
+
"description": null,
|
|
247
|
+
"grant_count": 1,
|
|
248
|
+
"allow_title": false,
|
|
249
|
+
"multiple_grant": false,
|
|
250
|
+
"icon": "fa-certificate",
|
|
251
|
+
"image": null,
|
|
252
|
+
"listable": true,
|
|
253
|
+
"enabled": true,
|
|
254
|
+
"badge_grouping_id": 2,
|
|
255
|
+
"system": true,
|
|
256
|
+
"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",
|
|
257
|
+
"trigger": 1,
|
|
258
|
+
"target_posts": true,
|
|
259
|
+
"auto_revoke": true,
|
|
260
|
+
"show_posts": true,
|
|
261
|
+
"badge_type_id": 3
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"id": 8,
|
|
265
|
+
"name": "Great Post",
|
|
266
|
+
"description": null,
|
|
267
|
+
"grant_count": 0,
|
|
268
|
+
"allow_title": false,
|
|
269
|
+
"multiple_grant": true,
|
|
270
|
+
"icon": "fa-certificate",
|
|
271
|
+
"image": null,
|
|
272
|
+
"listable": true,
|
|
273
|
+
"enabled": true,
|
|
274
|
+
"badge_grouping_id": 3,
|
|
275
|
+
"system": true,
|
|
276
|
+
"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",
|
|
277
|
+
"trigger": 1,
|
|
278
|
+
"target_posts": true,
|
|
279
|
+
"auto_revoke": true,
|
|
280
|
+
"show_posts": true,
|
|
281
|
+
"badge_type_id": 1
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"id": 20,
|
|
285
|
+
"name": "Great Topic",
|
|
286
|
+
"description": null,
|
|
287
|
+
"grant_count": 0,
|
|
288
|
+
"allow_title": false,
|
|
289
|
+
"multiple_grant": true,
|
|
290
|
+
"icon": "fa-certificate",
|
|
291
|
+
"image": null,
|
|
292
|
+
"listable": true,
|
|
293
|
+
"enabled": true,
|
|
294
|
+
"badge_grouping_id": 3,
|
|
295
|
+
"system": true,
|
|
296
|
+
"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",
|
|
297
|
+
"trigger": 1,
|
|
298
|
+
"target_posts": true,
|
|
299
|
+
"auto_revoke": true,
|
|
300
|
+
"show_posts": true,
|
|
301
|
+
"badge_type_id": 1
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"id": 7,
|
|
305
|
+
"name": "Good Post",
|
|
306
|
+
"description": null,
|
|
307
|
+
"grant_count": 0,
|
|
308
|
+
"allow_title": false,
|
|
309
|
+
"multiple_grant": true,
|
|
310
|
+
"icon": "fa-certificate",
|
|
311
|
+
"image": null,
|
|
312
|
+
"listable": true,
|
|
313
|
+
"enabled": true,
|
|
314
|
+
"badge_grouping_id": 3,
|
|
315
|
+
"system": true,
|
|
316
|
+
"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",
|
|
317
|
+
"trigger": 1,
|
|
318
|
+
"target_posts": true,
|
|
319
|
+
"auto_revoke": true,
|
|
320
|
+
"show_posts": true,
|
|
321
|
+
"badge_type_id": 2
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"id": 19,
|
|
325
|
+
"name": "Good Topic",
|
|
326
|
+
"description": null,
|
|
327
|
+
"grant_count": 0,
|
|
328
|
+
"allow_title": false,
|
|
329
|
+
"multiple_grant": true,
|
|
330
|
+
"icon": "fa-certificate",
|
|
331
|
+
"image": null,
|
|
332
|
+
"listable": true,
|
|
333
|
+
"enabled": true,
|
|
334
|
+
"badge_grouping_id": 3,
|
|
335
|
+
"system": true,
|
|
336
|
+
"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",
|
|
337
|
+
"trigger": 1,
|
|
338
|
+
"target_posts": true,
|
|
339
|
+
"auto_revoke": true,
|
|
340
|
+
"show_posts": true,
|
|
341
|
+
"badge_type_id": 2
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"id": 6,
|
|
345
|
+
"name": "Nice Post",
|
|
346
|
+
"description": null,
|
|
347
|
+
"grant_count": 0,
|
|
348
|
+
"allow_title": false,
|
|
349
|
+
"multiple_grant": true,
|
|
350
|
+
"icon": "fa-certificate",
|
|
351
|
+
"image": null,
|
|
352
|
+
"listable": true,
|
|
353
|
+
"enabled": true,
|
|
354
|
+
"badge_grouping_id": 3,
|
|
355
|
+
"system": true,
|
|
356
|
+
"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",
|
|
357
|
+
"trigger": 1,
|
|
358
|
+
"target_posts": true,
|
|
359
|
+
"auto_revoke": true,
|
|
360
|
+
"show_posts": true,
|
|
361
|
+
"badge_type_id": 3
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"id": 18,
|
|
365
|
+
"name": "Nice Topic",
|
|
366
|
+
"description": null,
|
|
367
|
+
"grant_count": 0,
|
|
368
|
+
"allow_title": false,
|
|
369
|
+
"multiple_grant": true,
|
|
370
|
+
"icon": "fa-certificate",
|
|
371
|
+
"image": null,
|
|
372
|
+
"listable": true,
|
|
373
|
+
"enabled": true,
|
|
374
|
+
"badge_grouping_id": 3,
|
|
375
|
+
"system": true,
|
|
376
|
+
"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",
|
|
377
|
+
"trigger": 1,
|
|
378
|
+
"target_posts": true,
|
|
379
|
+
"auto_revoke": true,
|
|
380
|
+
"show_posts": true,
|
|
381
|
+
"badge_type_id": 3
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"id": 4,
|
|
385
|
+
"name": "Leader",
|
|
386
|
+
"description": null,
|
|
387
|
+
"grant_count": 0,
|
|
388
|
+
"allow_title": true,
|
|
389
|
+
"multiple_grant": false,
|
|
390
|
+
"icon": "fa-user",
|
|
391
|
+
"image": null,
|
|
392
|
+
"listable": true,
|
|
393
|
+
"enabled": true,
|
|
394
|
+
"badge_grouping_id": 4,
|
|
395
|
+
"system": true,
|
|
396
|
+
"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",
|
|
397
|
+
"trigger": 4,
|
|
398
|
+
"target_posts": false,
|
|
399
|
+
"auto_revoke": true,
|
|
400
|
+
"show_posts": false,
|
|
401
|
+
"badge_type_id": 1
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"id": 3,
|
|
405
|
+
"name": "Regular",
|
|
406
|
+
"description": null,
|
|
407
|
+
"grant_count": 0,
|
|
408
|
+
"allow_title": true,
|
|
409
|
+
"multiple_grant": false,
|
|
410
|
+
"icon": "fa-user",
|
|
411
|
+
"image": null,
|
|
412
|
+
"listable": true,
|
|
413
|
+
"enabled": true,
|
|
414
|
+
"badge_grouping_id": 4,
|
|
415
|
+
"system": true,
|
|
416
|
+
"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",
|
|
417
|
+
"trigger": 4,
|
|
418
|
+
"target_posts": false,
|
|
419
|
+
"auto_revoke": true,
|
|
420
|
+
"show_posts": false,
|
|
421
|
+
"badge_type_id": 2
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"id": 1,
|
|
425
|
+
"name": "Basic User",
|
|
426
|
+
"description": null,
|
|
427
|
+
"grant_count": 0,
|
|
428
|
+
"allow_title": false,
|
|
429
|
+
"multiple_grant": false,
|
|
430
|
+
"icon": "fa-user",
|
|
431
|
+
"image": null,
|
|
432
|
+
"listable": true,
|
|
433
|
+
"enabled": true,
|
|
434
|
+
"badge_grouping_id": 4,
|
|
435
|
+
"system": true,
|
|
436
|
+
"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",
|
|
437
|
+
"trigger": 4,
|
|
438
|
+
"target_posts": false,
|
|
439
|
+
"auto_revoke": true,
|
|
440
|
+
"show_posts": false,
|
|
441
|
+
"badge_type_id": 3
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"id": 2,
|
|
445
|
+
"name": "Member",
|
|
446
|
+
"description": null,
|
|
447
|
+
"grant_count": 0,
|
|
448
|
+
"allow_title": false,
|
|
449
|
+
"multiple_grant": false,
|
|
450
|
+
"icon": "fa-user",
|
|
451
|
+
"image": null,
|
|
452
|
+
"listable": true,
|
|
453
|
+
"enabled": true,
|
|
454
|
+
"badge_grouping_id": 4,
|
|
455
|
+
"system": true,
|
|
456
|
+
"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",
|
|
457
|
+
"trigger": 4,
|
|
458
|
+
"target_posts": false,
|
|
459
|
+
"auto_revoke": true,
|
|
460
|
+
"show_posts": false,
|
|
461
|
+
"badge_type_id": 3
|
|
462
|
+
}
|
|
463
|
+
],
|
|
464
|
+
"badge_types": [
|
|
465
|
+
{
|
|
466
|
+
"id": 3,
|
|
467
|
+
"name": "Bronze",
|
|
468
|
+
"sort_order": 7
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"id": 1,
|
|
472
|
+
"name": "Gold",
|
|
473
|
+
"sort_order": 9
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"id": 2,
|
|
477
|
+
"name": "Silver",
|
|
478
|
+
"sort_order": 8
|
|
479
|
+
}
|
|
480
|
+
],
|
|
481
|
+
"badge_groupings": [
|
|
482
|
+
{
|
|
483
|
+
"id": 1,
|
|
484
|
+
"name": "Getting Started",
|
|
485
|
+
"description": null,
|
|
486
|
+
"position": 10
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"id": 2,
|
|
490
|
+
"name": "Community",
|
|
491
|
+
"description": null,
|
|
492
|
+
"position": 11
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"id": 3,
|
|
496
|
+
"name": "Posting",
|
|
497
|
+
"description": null,
|
|
498
|
+
"position": 12
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
"id": 4,
|
|
502
|
+
"name": "Trust Level",
|
|
503
|
+
"description": null,
|
|
504
|
+
"position": 13
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"id": 5,
|
|
508
|
+
"name": "Other",
|
|
509
|
+
"description": null,
|
|
510
|
+
"position": 14
|
|
511
|
+
}
|
|
512
|
+
],
|
|
513
|
+
"admin_badges": {
|
|
514
|
+
"protected_system_fields": [
|
|
515
|
+
"badge_type_id",
|
|
516
|
+
"multiple_grant",
|
|
517
|
+
"target_posts",
|
|
518
|
+
"show_posts",
|
|
519
|
+
"query",
|
|
520
|
+
"trigger",
|
|
521
|
+
"auto_revoke",
|
|
522
|
+
"listable"
|
|
523
|
+
],
|
|
524
|
+
"triggers": {
|
|
525
|
+
"none": 0,
|
|
526
|
+
"post_action": 1,
|
|
527
|
+
"post_revision": 2,
|
|
528
|
+
"trust_level_change": 4,
|
|
529
|
+
"user_change": 8
|
|
530
|
+
},
|
|
531
|
+
"badge_ids": [
|
|
532
|
+
9,
|
|
533
|
+
11,
|
|
534
|
+
14,
|
|
535
|
+
15,
|
|
536
|
+
12,
|
|
537
|
+
16,
|
|
538
|
+
17,
|
|
539
|
+
23,
|
|
540
|
+
22,
|
|
541
|
+
10,
|
|
542
|
+
13,
|
|
543
|
+
21,
|
|
544
|
+
5,
|
|
545
|
+
8,
|
|
546
|
+
20,
|
|
547
|
+
7,
|
|
548
|
+
19,
|
|
549
|
+
6,
|
|
550
|
+
18,
|
|
551
|
+
4,
|
|
552
|
+
3,
|
|
553
|
+
1,
|
|
554
|
+
2
|
|
555
|
+
],
|
|
556
|
+
"badge_grouping_ids": [
|
|
557
|
+
1,
|
|
558
|
+
2,
|
|
559
|
+
3,
|
|
560
|
+
4,
|
|
561
|
+
5
|
|
562
|
+
],
|
|
563
|
+
"badge_type_ids": [
|
|
564
|
+
1,
|
|
565
|
+
2,
|
|
566
|
+
3
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
}
|