Merge pull request #9450 from jakemcdermott/fix-9230

Use credential_type for prompted multicred select categories

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-03-04 19:51:59 +00:00 committed by GitHub
commit e1e0bb30a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,9 +167,10 @@ function CredentialsStep({ i18n }) {
const hasSameVaultID = val =>
val?.inputs?.vault_id !== undefined &&
val?.inputs?.vault_id === item?.inputs?.vault_id;
const hasSameKind = val => val.kind === item.kind;
const hasSameCredentialType = val =>
val.credential_type === item.credential_type;
const newItems = field.value.filter(i =>
isVault ? !hasSameVaultID(i) : !hasSameKind(i)
isVault ? !hasSameVaultID(i) : !hasSameCredentialType(i)
);
newItems.push(item);
helpers.setValue(newItems);