fix: validation error for empty Batch Enrollment/Beta Tester (#32684)

Co-authored-by: Muhammad Abdullah Waheed <42172960+abdullahwaheed@users.noreply.github.com>
This commit is contained in:
Dmytro
2024-03-21 10:24:30 +01:00
committed by GitHub
parent 71396c33a5
commit 79f6223f69

View File

@@ -503,14 +503,20 @@ such that the value can be defined later than this assignment (file load order).
}));
$idsList = $('<ul/>');
$taskResSection.append($idsList);
for (j = 0, len1 = ids.length; j < len1; j++) {
identifier = ids[j];
$idsList.append($('<li/>', {
text: identifier
}));
}
if (ids && ids.length > 0) {
for (j = 0, len1 = ids.length; j < len1; j++) {
identifier = ids[j];
$idsList.append($('<li/>', {
text: identifier
}));
}
}
return displayResponse.$task_response.append($taskResSection);
};
if (errors.length === 0 && successes.length === 0 && noUsers.length === 0) {
// Translators: For cases when the input field is empty;
renderList(gettext('This field must not be blank'), []);
}
if (successes.length && dataFromServer.action === 'add') {
var j, len1, inActiveUsers, activeUsers; // eslint-disable-line vars-on-top
activeUsers = [];
@@ -574,9 +580,6 @@ such that the value can be defined later than this assignment (file load order).
}()));
}
if (noUsers.length) {
noUsers.push($(
gettext('Users must create and activate their account before they can be promoted to beta tester.'))
);
return renderList(gettext('Could not find users associated with the following identifiers:'), (function() { // eslint-disable-line max-len
// eslint-disable-next-line no-shadow
var j, len1, results;
@@ -585,6 +588,9 @@ such that the value can be defined later than this assignment (file load order).
sr = noUsers[j];
results.push(sr.identifier);
}
results.unshift(
gettext('Users must create and activate their account before they can be promoted to beta tester.')
);
return results;
}()));
}
@@ -699,14 +705,28 @@ such that the value can be defined later than this assignment (file load order).
}));
$idsList = $('<ul/>');
$taskResSection.append($idsList);
for (h = 0, len3 = ids.length; h < len3; h++) {
identifier = ids[h];
$idsList.append($('<li/>', {
text: identifier
}));
if (ids && ids.length > 0) {
for (h = 0, len3 = ids.length; h < len3; h++) {
identifier = ids[h];
$idsList.append($('<li/>', {
text: identifier
}));
}
}
return displayResponse.$task_response.append($taskResSection);
};
if (
invalidIdentifier.length === 0
&& errors.length === 0
&& enrolled.length === 0
&& allowed.length === 0
&& autoenrolled.length === 0
&& notenrolled.length === 0
&& notunenrolled.length === 0
) {
// Translators: For cases when the input field is empty;
renderList(gettext('This field must not be blank'), []);
}
if (invalidIdentifier.length) {
renderList(gettext('The following email addresses and/or usernames are invalid:'), (function() {
var m, len4, results;