lib/cosgrove/comment_job.rb in cosgrove-0.0.4.0 vs lib/cosgrove/comment_job.rb in cosgrove-0.0.4.1
- old
+ new
@@ -4,13 +4,13 @@
class CommentJob
include Utils
include Support
def perform(event, slug, template, message = nil)
- chain = :steem
+ chain = :hive
author_name, permlink = parse_slug slug
- muted = muted by: steem_account, chain: chain
+ muted = muted by: hive_account, chain: chain
author = find_author(chain: chain, author_name: author_name)
return if author.nil?
@@ -48,11 +48,11 @@
elsif muted.include? author_name
puts "Won't vote because author muted."
'Unable to vote.'
# elsif template == :welcome && author.post_count != 1
# 'Sorry, this function is intended to welcome new authors.'
- elsif find_comment(chain: :steem, author_name: steem_account, parent_permlink: post.permlink).any?
+ elsif find_comment(chain: :hive, author_name: hive_account, parent_permlink: post.permlink).any?
title = post.title
title = post.permlink if title.empty?
"I already commented on #{title} by #{post.author}."
end
@@ -63,10 +63,10 @@
now = Time.now
comment = {
type: :comment,
parent_permlink: post.permlink,
- author: steem_account,
+ author: hive_account,
permlink: "re-#{post.author.gsub(/[^a-z0-9\-]+/, '-')}-#{post.permlink}-#{now.utc.strftime('%Y%m%dt%H%M%S%Lz')}", # e.g.: 20170225t235138025z
title: '',
body: merge(template, message, event.author.username),
json_metadata: "{\"tags\":[\"#{post.parent_permlink}\"],\"app\":\"#{Cosgrove::AGENT_ID}\"}",
parent_author: post.author