@@ -503,14 +503,20 @@ such that the value can be defined later than this assignment (file load order).
503503 } ) ) ;
504504 $idsList = $ ( '<ul/>' ) ;
505505 $taskResSection . append ( $idsList ) ;
506- for ( j = 0 , len1 = ids . length ; j < len1 ; j ++ ) {
507- identifier = ids [ j ] ;
508- $idsList . append ( $ ( '<li/>' , {
509- text : identifier
510- } ) ) ;
511- }
506+ if ( ids && ids . length > 0 ) {
507+ for ( j = 0 , len1 = ids . length ; j < len1 ; j ++ ) {
508+ identifier = ids [ j ] ;
509+ $idsList . append ( $ ( '<li/>' , {
510+ text : identifier
511+ } ) ) ;
512+ }
513+ }
512514 return displayResponse . $task_response . append ( $taskResSection ) ;
513515 } ;
516+ if ( errors . length === 0 && successes . length === 0 && noUsers . length === 0 ) {
517+ // Translators: For cases when the input field is empty;
518+ renderList ( gettext ( 'This field must not be blank' ) , [ ] ) ;
519+ }
514520 if ( successes . length && dataFromServer . action === 'add' ) {
515521 var j , len1 , inActiveUsers , activeUsers ; // eslint-disable-line vars-on-top
516522 activeUsers = [ ] ;
@@ -574,9 +580,6 @@ such that the value can be defined later than this assignment (file load order).
574580 } ( ) ) ) ;
575581 }
576582 if ( noUsers . length ) {
577- noUsers . push ( $ (
578- gettext ( 'Users must create and activate their account before they can be promoted to beta tester.' ) )
579- ) ;
580583 return renderList ( gettext ( 'Could not find users associated with the following identifiers:' ) , ( function ( ) { // eslint-disable-line max-len
581584 // eslint-disable-next-line no-shadow
582585 var j , len1 , results ;
@@ -585,6 +588,9 @@ such that the value can be defined later than this assignment (file load order).
585588 sr = noUsers [ j ] ;
586589 results . push ( sr . identifier ) ;
587590 }
591+ results . unshift (
592+ gettext ( 'Users must create and activate their account before they can be promoted to beta tester.' )
593+ ) ;
588594 return results ;
589595 } ( ) ) ) ;
590596 }
@@ -699,14 +705,28 @@ such that the value can be defined later than this assignment (file load order).
699705 } ) ) ;
700706 $idsList = $ ( '<ul/>' ) ;
701707 $taskResSection . append ( $idsList ) ;
702- for ( h = 0 , len3 = ids . length ; h < len3 ; h ++ ) {
703- identifier = ids [ h ] ;
704- $idsList . append ( $ ( '<li/>' , {
705- text : identifier
706- } ) ) ;
708+ if ( ids && ids . length > 0 ) {
709+ for ( h = 0 , len3 = ids . length ; h < len3 ; h ++ ) {
710+ identifier = ids [ h ] ;
711+ $idsList . append ( $ ( '<li/>' , {
712+ text : identifier
713+ } ) ) ;
714+ }
707715 }
708716 return displayResponse . $task_response . append ( $taskResSection ) ;
709717 } ;
718+ if (
719+ invalidIdentifier . length === 0
720+ && errors . length === 0
721+ && enrolled . length === 0
722+ && allowed . length === 0
723+ && autoenrolled . length === 0
724+ && notenrolled . length === 0
725+ && notunenrolled . length === 0
726+ ) {
727+ // Translators: For cases when the input field is empty;
728+ renderList ( gettext ( 'This field must not be blank' ) , [ ] ) ;
729+ }
710730 if ( invalidIdentifier . length ) {
711731 renderList ( gettext ( 'The following email addresses and/or usernames are invalid:' ) , ( function ( ) {
712732 var m , len4 , results ;
0 commit comments