FIX: Don't try to create a reviewable user twice

FIX: Don’t try to create a reviewable user twice

diff --git a/app/jobs/regular/create_user_reviewable.rb b/app/jobs/regular/create_user_reviewable.rb
index fb1824c..07ddb22 100644
--- a/app/jobs/regular/create_user_reviewable.rb
+++ b/app/jobs/regular/create_user_reviewable.rb
@@ -29,5 +29,7 @@ class Jobs::CreateUserReviewable < Jobs::Base
       )
     end
 
+  rescue ActiveRecord::RecordNotUnique
+    # If the reviewable is somehow queued twice, we can ignore.
   end
 end
diff --git a/spec/jobs/create_user_reviewable_spec.rb b/spec/jobs/create_user_reviewable_spec.rb
index acab20b..a201c5c 100644
--- a/spec/jobs/create_user_reviewable_spec.rb
+++ b/spec/jobs/create_user_reviewable_spec.rb
@@ -17,6 +17,12 @@ describe Jobs::CreateUserReviewable do
     expect(reviewable.payload['email']).to eq(user.email)
   end
 
+  it "should not raise an error if there is a reviewable already" do
+    SiteSetting.must_approve_users = true
+    described_class.new.execute(user_id: user.id)
+    described_class.new.execute(user_id: user.id)
+  end
+
   describe "reasons" do
     it "does nothing if there's no reason" do
       described_class.new.execute(user_id: user.id)

GitHub sha: d21dd521