From: Grégoire Aubert Date: Fri, 10 Aug 2018 13:53:11 +0000 (+0200) Subject: SONAR-11148 Fix bad use of scmAccount param in api/users/update X-Git-Tag: 7.5~597 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3ee7baceba601526f60ea2a78decfc0b6c8feb8e;p=sonarqube.git SONAR-11148 Fix bad use of scmAccount param in api/users/update --- diff --git a/server/sonar-web/src/main/js/api/users.ts b/server/sonar-web/src/main/js/api/users.ts index 055be31081f..f266f79bd41 100644 --- a/server/sonar-web/src/main/js/api/users.ts +++ b/server/sonar-web/src/main/js/api/users.ts @@ -88,9 +88,12 @@ export function updateUser(data: { email?: string; login: string; name?: string; - scmAccount?: string; + scmAccount: string[]; }): Promise { - return postJSON('/api/users/update', data); + return postJSON('/api/users/update', { + ...data, + scmAccount: data.scmAccount.length > 0 ? data.scmAccount : '' + }); } export function deactivateUser(data: { login: string }): Promise { 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 c3c4e670af0..75b581deea3 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 @@ -124,7 +124,7 @@ export default class UserForm extends React.PureComponent { email: this.state.email, login: this.state.login, name: this.state.name, - scmAccount: uniq(this.state.scmAccounts).join(',') + scmAccount: uniq(this.state.scmAccounts) }).then(() => { this.props.onUpdateUsers(); this.props.onClose(); @@ -249,7 +249,7 @@ export default class UserForm extends React.PureComponent { /> ))}
-
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserScmAccountInput.tsx b/server/sonar-web/src/main/js/apps/users/components/UserScmAccountInput.tsx index 6f93c423cd2..322a60c182f 100644 --- a/server/sonar-web/src/main/js/apps/users/components/UserScmAccountInput.tsx +++ b/server/sonar-web/src/main/js/apps/users/components/UserScmAccountInput.tsx @@ -35,7 +35,7 @@ export default class UserScmAccountInput extends React.PureComponent { render() { return ( -
+
{ const { scmAccounts } = this.props; const limit = scmAccounts.length > SCM_LIMIT ? SCM_LIMIT - 1 : SCM_LIMIT; return ( -
    +
      {scmAccounts.slice(0, limit).map((scmAccount, idx) => (
    • {scmAccount}