mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:44:40 +08:00
FIX: Do not validate email in TL promotion (#20892)
There is no need to validate the user's emails when promoting/demoting their trust level, this can cause issues in things like Jobs::Tl3Promotions, we don't need to fail in that case when all we are doing is changing trust level.
This commit is contained in:
@ -273,4 +273,18 @@ RSpec.describe Promotion do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#change_trust_level!" do
|
||||
fab!(:user) { Fabricate(:user, trust_level: TrustLevel[0]) }
|
||||
let(:promotion) { Promotion.new(user) }
|
||||
|
||||
context "when the user has no emails" do
|
||||
before { user.user_emails.delete_all }
|
||||
|
||||
it "does not error" do
|
||||
expect { promotion.change_trust_level!(TrustLevel[1]) }.not_to raise_error
|
||||
expect(user.reload.trust_level).to eq(TrustLevel[1])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user