Use new event to trigger vote_release

This commit is contained in:
Joe Buhlig 2016-02-24 10:31:47 -06:00
parent b7c503d3c2
commit 6d926ab101
1 changed files with 21 additions and 1 deletions

View File

@ -133,6 +133,26 @@ after_initialize do
return 0
end
end
end
require_dependency "jobs/base"
module ::Jobs
class VoteRelease < Jobs::Base
def execute(args)
byebug
if topic = Topic.find_by(id: args[:topic_id])
byebug
end
end
end
end
DiscourseEvent.on(:topic_status_updated) do |topic_id, status, enabled|
if status == 'closed' && enabled == true
byebug
Jobs.enqueue(:vote_release, {topic_id: topic_id})
end
end
Discourse::Application.routes.append do