FIX: Zeitwerk-related fixes for jobs. (#8219)

FIX: Zeitwerk-related fixes for jobs. (#8219)

diff --git a/app/jobs/regular/bulk_invite.rb b/app/jobs/regular/bulk_invite.rb
index b5980a0db9..8a5d248548 100644
--- a/app/jobs/regular/bulk_invite.rb
+++ b/app/jobs/regular/bulk_invite.rb
@@ -25,7 +25,7 @@ module Jobs
       process_invites(invites)
 
       if @total_invites > Invite::BULK_INVITE_EMAIL_LIMIT
-        Jobs.enqueue(:process_bulk_invite_emails)
+        ::Jobs.enqueue(:process_bulk_invite_emails)
       end
     ensure
       notify_user
diff --git a/app/jobs/regular/emit_web_hook_event.rb b/app/jobs/regular/emit_web_hook_event.rb
index fd7f8ae2a7..74c8153ad6 100644
--- a/app/jobs/regular/emit_web_hook_event.rb
+++ b/app/jobs/regular/emit_web_hook_event.rb
@@ -93,7 +93,7 @@ module Jobs
         @retry_count += 1
         return if @retry_count > MAX_RETRY_COUNT
         delay = RETRY_BACKOFF**(@retry_count - 1)
-        Jobs.enqueue_in(delay.minutes, :emit_web_hook_event, @arguments)
+        ::Jobs.enqueue_in(delay.minutes, :emit_web_hook_event, @arguments)
       end
     end
 
diff --git a/app/jobs/regular/process_bulk_invite_emails.rb b/app/jobs/regular/process_bulk_invite_emails.rb
index c7901d29c0..f8b8a13846 100644
--- a/app/jobs/regular/process_bulk_invite_emails.rb
+++ b/app/jobs/regular/process_bulk_invite_emails.rb
@@ -10,9 +10,9 @@ module Jobs
       if pending_invite_ids.length > 0
         Invite.where(id: pending_invite_ids).update_all(emailed_status: Invite.emailed_status_types[:sending])
         pending_invite_ids.each do |invite_id|
-          Jobs.enqueue(:invite_email, invite_id: invite_id)
+          ::Jobs.enqueue(:invite_email, invite_id: invite_id)
         end
-        Jobs.enqueue_in(1.minute, :process_bulk_invite_emails)
+        ::Jobs.enqueue_in(1.minute, :process_bulk_invite_emails)
       end
     end
   end
diff --git a/app/jobs/regular/suspicious_login.rb b/app/jobs/regular/suspicious_login.rb
index 4ba98be381..2c08776c5d 100644
--- a/app/jobs/regular/suspicious_login.rb
+++ b/app/jobs/regular/suspicious_login.rb
@@ -12,7 +12,7 @@ module Jobs
                           user_agent: args[:user_agent],
                           client_ip: args[:client_ip])
 
-        Jobs.enqueue(:critical_user_email,
+        ::Jobs.enqueue(:critical_user_email,
                      type: :suspicious_login,
                      user_id: args[:user_id],
                      client_ip: args[:client_ip],
diff --git a/app/jobs/scheduled/activation_reminder_emails.rb b/app/jobs/scheduled/activation_reminder_emails.rb
index df0b1f86ec..171b5d139c 100644
--- a/app/jobs/scheduled/activation_reminder_emails.rb
+++ b/app/jobs/scheduled/activation_reminder_emails.rb
@@ -14,7 +14,7 @@ module Jobs
         user.save_custom_fields
 
         email_token = user.email_tokens.create!(email: user.email)
-        Jobs.enqueue(:user_email,
+        ::Jobs.enqueue(:user_email,
                      type: :activation_reminder,
                      user_id: user.id,
                      email_token: email_token.token)
diff --git a/app/jobs/scheduled/enqueue_digest_emails.rb b/app/jobs/scheduled/enqueue_digest_emails.rb
index 59b091263c..18db50135a 100644
--- a/app/jobs/scheduled/enqueue_digest_emails.rb
+++ b/app/jobs/scheduled/enqueue_digest_emails.rb
@@ -8,7 +8,7 @@ module Jobs
     def execute(args)
       return if SiteSetting.disable_digest_emails? || SiteSetting.private_email?
       target_user_ids.each do |user_id|
-        Jobs.enqueue(:user_email, type: :digest, user_id: user_id)
+        ::Jobs.enqueue(:user_email, type: :digest, user_id: user_id)
       end
     end
 
diff --git a/app/jobs/scheduled/schedule_backup.rb b/app/jobs/scheduled/schedule_backup.rb
index 8b9d43aff4..b64766a030 100644
--- a/app/jobs/scheduled/schedule_backup.rb
+++ b/app/jobs/scheduled/schedule_backup.rb
@@ -14,12 +14,12 @@ module Jobs
         return if (date + SiteSetting.backup_frequency.days) > Time.now.utc.to_date
       end
 
-      Jobs.cancel_scheduled_job(:create_backup)
+      ::Jobs.cancel_scheduled_job(:create_backup)
 
       time_of_day = Time.parse(SiteSetting.backup_time_of_day)
       seconds = time_of_day.hour.hours + time_of_day.min.minutes + rand(10.minutes)
 
-      Jobs.enqueue_in(seconds, :create_backup)
+      ::Jobs.enqueue_in(seconds, :create_backup)
     rescue => e
       notify_user(e)
       raise

GitHub sha: 13583125