]> source.dussan.org Git - sonarqube.git/commitdiff
Fix issue in users admin when editing user without scm accounts
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Fri, 1 Dec 2017 11:17:27 +0000 (12:17 +0100)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Fri, 1 Dec 2017 12:47:16 +0000 (13:47 +0100)
server/sonar-web/src/main/js/api/users.ts
server/sonar-web/src/main/js/apps/users/components/UserForm.tsx

index f78343b59695a75f078f85bd40e65219d01d57b5..d04b71bcd55b2c56bcf52509400d4918657da4a1 100644 (file)
@@ -33,7 +33,7 @@ export interface User {
   name: string;
   active: boolean;
   email?: string;
-  scmAccounts: string[];
+  scmAccounts?: string[];
   groups?: string[];
   tokensCount?: number;
   local: boolean;
@@ -90,7 +90,7 @@ export function updateUser(data: {
   email?: string;
   login: string;
   name?: string;
-  scmAccount: string[];
+  scmAccount?: string;
 }): Promise<User> {
   return postJSON('/api/users/update', data);
 }
index 292d13f85c8509dc02d4ea529231deb3219595dc..500594e7413b825211ec3744cafc1774135d83e8 100644 (file)
@@ -54,7 +54,7 @@ export default class UserForm extends React.PureComponent<Props, State> {
         login: user.login,
         name: user.name,
         password: '',
-        scmAccounts: user.scmAccounts,
+        scmAccounts: user.scmAccounts || [],
         submitting: false
       };
     } else {
@@ -124,7 +124,7 @@ export default class UserForm extends React.PureComponent<Props, State> {
       email: this.state.email || undefined,
       login: this.state.login,
       name: this.state.name,
-      scmAccount: uniq(this.state.scmAccounts)
+      scmAccount: uniq(this.state.scmAccounts).join(',')
     }).then(() => {
       this.props.onUpdateUsers();
       this.props.onClose();