Commit d8f1cafe authored by mh's avatar mh
Browse files

reset the over_quota flag when changing the quota - since obviously they might...

reset the over_quota flag when changing the quota - since obviously they might not anymore be over quota and otherwise it will be set back
parent 7812b399
Pipeline #9346 passed with stage
in 2 minutes and 43 seconds
......@@ -468,8 +468,7 @@ class UserManager
end
case action
when 'mbxquota'
u.mbxquota = value
u.save!
u.update!(mbxquota: value, over_quota: false)
when 'ratelimit'
u.ratelimit = value.present? ? value : nil
u.save!
......
......@@ -49,6 +49,24 @@ describe "iApi users admin route" do
e.reload
expect(AuthManager.send(:bcrypt_auth, e, pwd)).to include(state: 'success')
end
it 'resets over_quota flag when updating the quota' do
e = EmailUser.order(Arel.sql('random()')).first
e.update!(over_quota: true)
expect(e.mbxquota).to eql('1G')
post_as('admin', '/users_admin/update',
with_admin_api_token(
email: e.email,
action: 'mbxquota',
value: '2G'
)
)
expect(last_response).to be_ok
e.reload
expect(e.mbxquota).to eql('2G')
expect(e.over_quota).to be_falsy
end
end
context 'as any' do
it "should not allow access to wrong client" do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment