File tree Expand file tree Collapse file tree 1 file changed +4
-18
lines changed
Expand file tree Collapse file tree 1 file changed +4
-18
lines changed Original file line number Diff line number Diff line change @@ -167,25 +167,11 @@ export const postTrustInvolvedPage = async (
167167 const appData : ApplicationData = await fetchApplicationData ( req , isRegistration ) ;
168168 moveTrustOutOfReview ( appData ) ;
169169
170- const filterIndividualsInTrust = ( trust : any ) => {
171- if ( ! trust . INDIVIDUALS ?. length ) {
172- return ; // Early exit if there are no individuals
170+ appData ?. trusts ?. forEach ( trust => {
171+ if ( Array . isArray ( trust . INDIVIDUALS ) ) {
172+ trust . INDIVIDUALS = trust . INDIVIDUALS . filter ( ind => ind . forename ) ;
173173 }
174-
175- trust . INDIVIDUALS = trust . INDIVIDUALS . filter (
176- ( individual : any ) => Boolean ( individual . forename ) // Only keep individuals with a forename
177- ) ;
178- } ;
179- const filterTrustIndividuals = ( trusts : any [ ] | undefined ) => {
180- if ( ! trusts ?. length ) {
181- return ; // Early exit if no trusts are available
182- }
183-
184- trusts . forEach ( filterIndividualsInTrust ) ;
185- } ;
186- if ( appData ?. trusts ) {
187- filterTrustIndividuals ( appData . trusts ) ;
188- }
174+ } ) ;
189175 setExtraData ( req . session , appData ) ;
190176 if ( isActiveFeature ( config . FEATURE_FLAG_ENABLE_REDIS_REMOVAL ) && isRegistration ) {
191177 await updateOverseasEntity ( req , session , appData ) ;
You can’t perform that action at this time.
0 commit comments