Merge pull request #12027 from CartoDB/11837-default_org_quota

11837 default org quota
pull/12030/head
Juan Ignacio Sánchez Lara 8 years ago committed by GitHub
commit 985a3a04c5

@ -210,6 +210,7 @@ Development
* Redirect to last visited page after logging in (#11946)
* Sanitized HTML from map and layer names.
* Merged fix subdomain error not loading tiles (CartoDB.js#1607)
* Create users from org panel with the default quota (#11837)
* Fixed way to listen Deep-insights.js map or widgets changes (#11894)
* Using latest cartodb.js and deep-insights.js to tackle map zooming problem (support#605)
* Fix organization notifications issues (#11957)

@ -25,7 +25,7 @@ class Admin::OrganizationUsersController < Admin::AdminController
def new
@user = ::User.new
organization = current_user.organization
@user.quota_in_bytes = organization.unassigned_quota < 100.megabytes ? organization.unassigned_quota : 100.megabytes
@user.quota_in_bytes = [organization.unassigned_quota, organization.default_quota_in_bytes].min
@user.soft_geocoding_limit = current_user.soft_geocoding_limit
@user.soft_here_isolines_limit = current_user.soft_here_isolines_limit

@ -40,6 +40,30 @@ describe Admin::OrganizationUsersController do
login_as(@org_user_owner, scope: @org_user_owner.username)
end
describe '#new' do
it 'quota defaults to organization default' do
expected_quota = 123456789
Organization.any_instance.stubs(:default_quota_in_bytes).returns(expected_quota)
get new_organization_user_url(user_domain: @org_user_owner.username)
last_response.status.should eq 200
input = "<input id=\"user_quota\" name=\"user[quota_in_bytes]\" type=\"hidden\" value=\"#{expected_quota}\" />"
last_response.body.should include input
end
it 'quota defaults to remaining quota if the assigned default goes overquota' do
expected_quota = @organization.unassigned_quota
Organization.any_instance.stubs(:default_quota_in_bytes).returns(123456789012345)
get new_organization_user_url(user_domain: @org_user_owner.username)
last_response.status.should eq 200
input = "<input id=\"user_quota\" name=\"user[quota_in_bytes]\" type=\"hidden\" value=\"#{expected_quota}\" />"
last_response.body.should include input
end
end
describe '#show' do
it 'returns 200 for organization owner users' do
get organization_users_url(user_domain: @org_user_owner.username)

Loading…
Cancel
Save