FIX: Don't add the reviewable score twice

This commit is contained in:
Robin Ward 2019-04-23 15:46:18 -04:00
parent 21b975e71a
commit 70097966ed
2 changed files with 5 additions and 0 deletions

View File

@ -23,6 +23,8 @@ class Jobs::CreateUserReviewable < Jobs::Base
email: user.email
}
)
return if @reviewable.score > 0
@reviewable.add_score(
Discourse.system_user,
ReviewableScore.types[:needs_approval],

View File

@ -21,6 +21,9 @@ describe Jobs::CreateUserReviewable do
SiteSetting.must_approve_users = true
described_class.new.execute(user_id: user.id)
described_class.new.execute(user_id: user.id)
reviewable = Reviewable.find_by(target: user)
expect(reviewable.reviewable_scores.size).to eq(1)
end
describe "reasons" do