Commit c2fea370 authored by o's avatar o
Browse files

Merge branch 'reset_over_quota' into 'master'

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

See merge request !63
parents 7812b399 d8f1cafe
Pipeline #9354 passed with stage
in 2 minutes and 41 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