/
seed.rb
44 lines (38 loc) · 1.39 KB
/
seed.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true
module ::Patreon
class Seed
PLUGIN_NAME = 'discourse-patreon'.freeze
def self.seed_content!
default_group = Group.new(
name: 'patrons',
visibility_level: Group.visibility_levels[:public],
primary_group: true,
title: 'Patron',
flair_url: ::Patreon.default_image_url,
bio_raw: 'To get access to this group go to our [Patreon page](https://www.patreon.com/) and add your pledge.',
full_name: 'Our Patreon supporters'
)
default_group.save!
badge = Badge.new(
name: 'Patron',
description: 'Active Patron',
badge_type_id: 1,
icon: ::Patreon.default_image_url,
listable: true,
target_posts: false,
query: "select user_id, created_at granted_at, NULL post_id from group_users where group_id = ( select g.id from groups g where g.name = 'patrons' )",
enabled: true,
auto_revoke: true,
badge_grouping_id: 2,
trigger: 0,
show_posts: false,
system: false,
image: ::Patreon.default_image_url,
long_description: 'To get access to this badge go to our <a href="https://www.patreon.com/">Patreon page</a> and add your pledge.'
)
badge.save!
basic_filter = { default_group.id.to_s => ['0'] }
::PluginStore.set(PLUGIN_NAME, 'filters', basic_filter)
end
end
end