FIX: Don't create two reviewable scores for a user

FIX: Don’t create two reviewable scores for a user

diff --git a/app/jobs/regular/create_user_reviewable.rb b/app/jobs/regular/create_user_reviewable.rb
index 1109919..911728d 100644
--- a/app/jobs/regular/create_user_reviewable.rb
+++ b/app/jobs/regular/create_user_reviewable.rb
@@ -5,7 +5,7 @@ class Jobs::CreateUserReviewable < Jobs::Base
     if user = User.find_by(id: args[:user_id])
       return if user.approved?
 
-      reviewable = ReviewableUser.needs_review!(target: user, created_by: Discourse.system_user, reviewable_by_moderator: true)
+      reviewable = ReviewableUser.create!(target: user, created_by: Discourse.system_user, reviewable_by_moderator: true)
       reviewable.add_score(
         Discourse.system_user,
         ReviewableScore.types[:needs_approval],
diff --git a/app/models/email_token.rb b/app/models/email_token.rb
index cf9a188..0446970 100644
--- a/app/models/email_token.rb
+++ b/app/models/email_token.rb
@@ -57,7 +57,7 @@ class EmailToken < ActiveRecord::Base
     end
   end
 
-  def self.confirm(token)
+  def self.confirm(token, skip_reviewable: false)
     User.transaction do
       result = atomic_confirm(token)
       user = result[:user]
@@ -65,8 +65,9 @@ class EmailToken < ActiveRecord::Base
         # If we are activating the user, send the welcome message
         user.send_welcome_message = !user.active?
         user.email = result[:email_token].email
+        user.active = true
         user.save!
-        user.activate
+        user.create_reviewable unless skip_reviewable
         user.set_automatic_groups
       end
 
diff --git a/app/models/user.rb b/app/models/user.rb
index df6c4b3..57d51dc 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -892,7 +892,7 @@ class User < ActiveRecord::Base
 
   def activate
     if email_token = self.email_tokens.active.where(email: self.email).first
-      user = EmailToken.confirm(email_token.token)
+      user = EmailToken.confirm(email_token.token, skip_reviewable: true)
       self.update!(active: true) if user.nil?
     else
       self.update!(active: true)

GitHub sha: 82bddcbe