cosgrove 0.0.1rc6 → 0.0.1rc7
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/Gemfile.lock +1 -1
- data/lib/cosgrove/config.rb +18 -0
- data/lib/cosgrove/upvote_job.rb +4 -0
- data/lib/cosgrove/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5843bf0c639c5f36039db3cd729c9dd081571dc4
|
4
|
+
data.tar.gz: ff7a430fe1013201e3ff4018d7c10cf8d4bc07f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c28bfcf611a16d891248b4abf5c1110c010a2f602d45adebc8c51ea6f8fb8b830a6734319c317b7ec4eb566e87d4601575969ec37d7bce1462a3afd05694b254
|
7
|
+
data.tar.gz: fa97afa5b24ec0e142cf423c936497878bf21b518a29b5488022527fb8a431205e1936e40e22862a8ac552db08d732b92f6fe8bad33470451dcfb99dfd064b28
|
data/Gemfile.lock
CHANGED
data/lib/cosgrove/config.rb
CHANGED
@@ -16,6 +16,10 @@ module Cosgrove
|
|
16
16
|
yml[:cosgrove][:upvote_weight]
|
17
17
|
end
|
18
18
|
|
19
|
+
def cosgrove_disable_comment_voting
|
20
|
+
yml[:cosgrove][:disable_comment_voting].to_s == 'true'
|
21
|
+
end
|
22
|
+
|
19
23
|
def steem_api_url
|
20
24
|
chain[:steem_api_url]
|
21
25
|
end
|
@@ -74,6 +78,20 @@ module Cosgrove
|
|
74
78
|
|
75
79
|
weight || default_weight
|
76
80
|
end
|
81
|
+
|
82
|
+
def channel_disable_comment_voting(channel_id)
|
83
|
+
rules = yml[:cosgrove][:upvote_rules][:channels]
|
84
|
+
default_disable_comment_voting = rules[:default][:disable_comment_voting].to_s == 'true' rescue false
|
85
|
+
|
86
|
+
keys = rules.keys - [:default]
|
87
|
+
|
88
|
+
disable_comment_voting = keys.map do |key|
|
89
|
+
rule = rules[key]
|
90
|
+
rule[:disable_comment_voting] if rule[:channel_id] == channel_id
|
91
|
+
end.compact.last
|
92
|
+
|
93
|
+
disable_comment_voting || default_disable_comment_voting
|
94
|
+
end
|
77
95
|
private
|
78
96
|
def chain
|
79
97
|
@chain ||= yml[:chain]
|
data/lib/cosgrove/upvote_job.rb
CHANGED
@@ -49,6 +49,7 @@ module Cosgrove
|
|
49
49
|
|
50
50
|
created ||= post.created
|
51
51
|
cashout_time ||= post.cashout_time
|
52
|
+
root_post = post.parent_author == ''
|
52
53
|
|
53
54
|
nope = if created > 1.minute.ago
|
54
55
|
"Give it a second! It's going to SPACE! Can you give it a second to come back from space?"
|
@@ -71,6 +72,9 @@ module Cosgrove
|
|
71
72
|
elsif muted.include? author_name
|
72
73
|
puts "Won't vote because author muted."
|
73
74
|
'Unable to vote.'
|
75
|
+
elsif !root_post && channel_disable_comment_voting(event.channel.id)
|
76
|
+
puts "Won't vote because comment voting is disabled."
|
77
|
+
'Unable to vote.'
|
74
78
|
elsif !registered
|
75
79
|
'Unable to vote. Feature resticted to registered users.'
|
76
80
|
elsif cb_account.novote?
|
data/lib/cosgrove/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cosgrove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1rc7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|