From 6d926ab1012a24a2d07c6b557709b9c4959ff2f9 Mon Sep 17 00:00:00 2001 From: Joe Buhlig Date: Wed, 24 Feb 2016 10:31:47 -0600 Subject: [PATCH] Use new event to trigger vote_release --- plugin.rb | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 6187e15..f88719f 100755 --- a/plugin.rb +++ b/plugin.rb @@ -109,7 +109,7 @@ after_initialize do def vote_limit object.vote_limit end - + end require_dependency 'topic' @@ -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