From: Grégoire Aubert Date: Fri, 1 Dec 2017 11:17:27 +0000 (+0100) Subject: Fix issue in users admin when editing user without scm accounts X-Git-Tag: 7.0-RC1~247 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=da198c7706fbc244e644665a4e9b5026e929d9de;p=sonarqube.git Fix issue in users admin when editing user without scm accounts --- diff --git a/server/sonar-web/src/main/js/api/users.ts b/server/sonar-web/src/main/js/api/users.ts index f78343b5969..d04b71bcd55 100644 --- a/server/sonar-web/src/main/js/api/users.ts +++ b/server/sonar-web/src/main/js/api/users.ts @@ -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 { return postJSON('/api/users/update', data); } diff --git a/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx b/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx index 292d13f85c8..500594e7413 100644 --- a/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx +++ b/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx @@ -54,7 +54,7 @@ export default class UserForm extends React.PureComponent { 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 { 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();