Fixed label serialization in members bulk importer

no issue

- After a refactor logic was missing trimming logic and handling for empty labels
This commit is contained in:
Nazar Gargol 2020-08-20 16:43:42 +12:00
parent 32fd913ac3
commit 4498b4624a

View File

@ -140,8 +140,8 @@ function serializeMemberLabels(labels) {
if (typeof label !== 'string') {
return labelsAcc.concat(label.name);
}
return labelsAcc.concat(label);
});
return labelsAcc.concat(label.trim());
}, []);
}
function getMemberData({members, allLabelModels, importSetLabels, createdBy}) {
@ -213,7 +213,9 @@ function getMemberData({members, allLabelModels, importSetLabels, createdBy}) {
};
membersToInsert.push(memberToInsert);
const memberLabels = serializeMemberLabels((member.labels || '').split(','));
const memberLabels = member.labels
? serializeMemberLabels((member.labels || '').split(','))
: [];
const allLabels = _.union(memberLabels, importedLabels);
const memberLabelAssociationsToInsert = allLabels.map((label, index) => {