Use new event to trigger vote_release
This commit is contained in:
parent
b7c503d3c2
commit
6d926ab101
20
plugin.rb
20
plugin.rb
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue