]> source.dussan.org Git - sonarqube.git/commitdiff
SONARCLOUD-128 allow up to 300 characters for org name and key
authorStas Vilchik <vilchiks@gmail.com>
Fri, 5 Oct 2018 12:35:06 +0000 (14:35 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 10 Oct 2018 07:23:02 +0000 (09:23 +0200)
server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx
server/sonar-web/src/main/js/apps/create/organization/__tests__/OrganizationDetailsStep-test.tsx
server/sonar-web/src/main/js/apps/create/organization/__tests__/__snapshots__/OrganizationDetailsStep-test.tsx.snap
server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx
server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.tsx.snap
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 4c7f28a20a607a38d48e6752b356ada530441b35..7ae7f7867bbad4bb981ca1d7251786118535fc66 100644 (file)
@@ -84,11 +84,11 @@ export default class OrganizationDetailsStep extends React.PureComponent<Props,
       errors.avatar = translate('onboarding.create_organization.avatar.error');
     }
 
-    if (name.length > 0 && (name.length < 2 || name.length > 64)) {
+    if (name.length > 300) {
       errors.name = translate('onboarding.create_organization.display_name.error');
     }
 
-    if (key.length < 2 || key.length > 32 || !/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(key)) {
+    if (key.length > 300 || !/^[a-z0-9][a-z0-9-]*[a-z0-9]?$/.test(key)) {
       errors.key = translate('onboarding.create_organization.organization_name.error');
     }
 
@@ -134,7 +134,7 @@ export default class OrganizationDetailsStep extends React.PureComponent<Props,
           required={true}
           touched={touched.key}
           value={values.key}>
-          {props => <input autoFocus={true} {...props} />}
+          {props => <input autoFocus={true} maxLength={300} {...props} />}
         </OrganizationDetailsInput>
         <div className="big-spacer-top">
           <ResetButtonLink onClick={this.handleAdditionalClick}>
@@ -224,7 +224,7 @@ export default class OrganizationDetailsStep extends React.PureComponent<Props,
     return organization ? (
       <div className="boxed-group-actions display-flex-center">
         <AlertSuccessIcon className="spacer-right" />
-        <strong>{organization.key}</strong>
+        <strong className="text-limited">{organization.key}</strong>
       </div>
     ) : null;
   };
index 056856e7c6d1f0f55a150e6ad8efdfdc2a73c531..5eb6b9a65b4055d3a138456362f330861c70f556 100644 (file)
@@ -74,22 +74,24 @@ it('should validate', () => {
   ).resolves.toEqual({});
 
   expect(
-    instance.handleValidate({ avatar: '', description: '', name: '', key: '', url: '' })
+    instance.handleValidate({
+      avatar: '',
+      description: '',
+      name: '',
+      key: 'x'.repeat(301),
+      url: ''
+    })
   ).rejects.toEqual({ key: 'onboarding.create_organization.organization_name.error' });
 
   expect(
     instance.handleValidate({ avatar: 'bla', description: '', name: '', key: 'foo', url: '' })
   ).rejects.toEqual({ avatar: 'onboarding.create_organization.avatar.error' });
 
-  expect(
-    instance.handleValidate({ avatar: '', description: '', name: 'x', key: 'foo', url: '' })
-  ).rejects.toEqual({ name: 'onboarding.create_organization.display_name.error' });
-
   expect(
     instance.handleValidate({
       avatar: '',
       description: '',
-      name: 'x'.repeat(65),
+      name: 'x'.repeat(301),
       key: 'foo',
       url: ''
     })
index c792c9ff872af45230fc3ed4432a18555f6c5f9e..14f3109b7eb64b2c62458d1fd97bd73ad737991a 100644 (file)
@@ -177,7 +177,9 @@ exports[`should render result 1`] = `
     <AlertSuccessIcon
       className="spacer-right"
     />
-    <strong>
+    <strong
+      className="text-limited"
+    >
       org
     </strong>
   </div>
index fa0bb5ca7f26e94d9ba0079dc1f3b847e9b1c1c4..28e99ee3a3e8fafc05eba901bfff2d7f6907be93 100644 (file)
@@ -119,7 +119,7 @@ export class OrganizationEdit extends React.PureComponent<Props, State> {
               <input
                 disabled={this.state.loading}
                 id="organization-name"
-                maxLength={64}
+                maxLength={300}
                 name="name"
                 onChange={e => this.setState({ name: e.target.value })}
                 required={true}
index 054e031416356f7e3bf5933343259b1fca11536e..63cf648f3172f5433e9434cc1286d5b7b81b9bbc 100644 (file)
@@ -40,7 +40,7 @@ exports[`smoke test 1`] = `
         <input
           disabled={false}
           id="organization-name"
-          maxLength={64}
+          maxLength={300}
           name="name"
           onChange={[Function]}
           required={true}
@@ -176,7 +176,7 @@ exports[`smoke test 2`] = `
         <input
           disabled={false}
           id="organization-name"
-          maxLength={64}
+          maxLength={300}
           name="name"
           onChange={[Function]}
           required={true}
@@ -327,7 +327,7 @@ exports[`smoke test 3`] = `
         <input
           disabled={true}
           id="organization-name"
-          maxLength={64}
+          maxLength={300}
           name="name"
           onChange={[Function]}
           required={true}
index 88d2afea1456d899f8b8be43eb636dd7fc374eb6..24d6a527259bbf9d63f65bfbde84f012b7b3cefb 100644 (file)
@@ -2600,9 +2600,9 @@ organization.description=Description
 organization.description.description=Description of the organization.
 organization.edit=Edit Organization
 organization.key=Key
-organization.key.description=Key of the organization (2 to 32 characters). All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading). When not specified, the key is computed from the name.
+organization.key.description=Key of the organization (up to 300 characters). All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading). When not specified, the key is computed from the name.
 organization.name=Name
-organization.name.description=Name of the organization (2 to 64 characters).
+organization.name.description=Name of the organization (up to 300 characters).
 organization.updated=Organization details have been updated.
 organization.url=Url
 organization.url.description=Url of the homepage of the organization.
@@ -2699,13 +2699,13 @@ onboarding.create_project.select_repositories=Select repositories
 onboarding.create_organization.page.header=Create Organization
 onboarding.create_organization.page.description=An organization is a space where a team or a whole company can collaborate accross many projects.{break}To analyze a private project you must subscribe your organization to a paid plan. From {price} a month. {more}
 onboarding.create_organization.organization_name=Organization Name
-onboarding.create_organization.organization_name.description=2 to 32 characters. All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading). The display name can be specified in the additional info.
+onboarding.create_organization.organization_name.description=Up to 300 characters. All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading). The display name can be specified in the additional info.
 onboarding.create_organization.organization_name.error=The provided value doesn't match the expected format.
 onboarding.create_organization.organization_name.taken=This name is already taken.
 onboarding.create_organization.add_additional_info=Add additional info
 onboarding.create_organization.hide_additional_info=Hide additional info
 onboarding.create_organization.display_name=Display Name
-onboarding.create_organization.display_name.description=2 to 64 characters
+onboarding.create_organization.display_name.description=Up to 300 characters
 onboarding.create_organization.display_name.error=The provided value doesn't match the expected format.
 onboarding.create_organization.avatar=Avatar
 onboarding.create_organization.avatar.description=Url of a small image that represents the organization (preferably 30px height).