lib/cosgrove/config.rb in cosgrove-0.0.1rc6 vs lib/cosgrove/config.rb in cosgrove-0.0.1rc7
- old
+ new
@@ -14,10 +14,14 @@
def cosgrove_upvote_weight
yml[:cosgrove][:upvote_weight]
end
+ def cosgrove_disable_comment_voting
+ yml[:cosgrove][:disable_comment_voting].to_s == 'true'
+ end
+
def steem_api_url
chain[:steem_api_url]
end
def golos_api_url
@@ -71,9 +75,23 @@
rule = rules[key]
rule[:upvote_weight] if rule[:channel_id] == channel_id
end.compact.last
weight || default_weight
+ end
+
+ def channel_disable_comment_voting(channel_id)
+ rules = yml[:cosgrove][:upvote_rules][:channels]
+ default_disable_comment_voting = rules[:default][:disable_comment_voting].to_s == 'true' rescue false
+
+ keys = rules.keys - [:default]
+
+ disable_comment_voting = keys.map do |key|
+ rule = rules[key]
+ rule[:disable_comment_voting] if rule[:channel_id] == channel_id
+ end.compact.last
+
+ disable_comment_voting || default_disable_comment_voting
end
private
def chain
@chain ||= yml[:chain]
end