require the job in plugin

This commit is contained in:
Rimian Perkins 2017-04-27 16:35:28 +10:00
parent 1feb997122
commit b94a01359a
3 changed files with 4 additions and 12 deletions

View File

@ -1,16 +1,7 @@
# Discourse forces the namespace at top level :(
module Jobs
class AwardGroup
def perform(args)
puts '====================== The Job was performed ==========================='
end
def self.perform_in(arg, opts)
puts '====================== The Job was enqueued ==========================='
end
def execute(args)
class AwardGroup < ::Jobs::Onceoff
def execute_onceoff(args)
puts '====================== The Job was executed ==========================='
user = User.find_by_email(args[:email])
if user.present?

View File

@ -1,4 +1,3 @@
require_relative '../../app/jobs/award_group'
module ::DiscourseDonations
class Engine < ::Rails::Engine

View File

@ -11,6 +11,8 @@ load File.expand_path('../lib/discourse_donations/engine.rb', __FILE__)
enabled_site_setting :discourse_donations_enabled
after_initialize do
load File.expand_path('../app/jobs/award_group.rb', __FILE__)
# Must be placed on every page for fraud protection.
header_script = '<script src="https://js.stripe.com/v3/"></script>'
discourse_donations_theme = Theme.find_or_create_by(name: 'Discourse Donations Header', hidden: false, user_id: -1)