DEV: Skip the CheckUsersForSpam job if the user was deleted. (#15)

DEV: Skip the CheckUsersForSpam job if the user was deleted. (#15)

diff --git a/jobs/regular/check_users_for_spam.rb b/jobs/regular/check_users_for_spam.rb
index f156343..2b74aa7 100644
--- a/jobs/regular/check_users_for_spam.rb
+++ b/jobs/regular/check_users_for_spam.rb
@@ -4,7 +4,7 @@ module Jobs
   class CheckUsersForSpam < ::Jobs::Base
     def execute(args)
       user = User.includes(:user_profile).find_by(id: args[:user_id])
-      raise Discourse::InvalidParameters.new(:user_id) unless user.present?
+      return if user.nil?
 
       client = Akismet::Client.build_client
       DiscourseAkismet::UsersBouncer.new.perform_check(client, user)
diff --git a/spec/jobs/regular/check_users_for_spam_spec.rb b/spec/jobs/regular/check_users_for_spam_spec.rb
deleted file mode 100644
index 190275e..0000000
--- a/spec/jobs/regular/check_users_for_spam_spec.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-require 'rails_helper'
-
-RSpec.describe Jobs::CheckUsersForSpam do
-  describe '#execute' do
-    it "should raise the right error when user_id is invalid" do
-      expect do
-        described_class.new.execute({})
-      end.to raise_error(Discourse::InvalidParameters)
-    end
-  end
-end

GitHub sha: 5ede87ab

This commit appears in #15 which was approved by CvX. It was merged by romanrizzi.