@@ -113,16 +113,23 @@ export class SubmissionObjectEffects {
113113 const sectionId = selfLink . substr ( selfLink . lastIndexOf ( '/' ) + 1 ) ;
114114 const config = sectionDefinition . _links . config ? ( sectionDefinition . _links . config . href || sectionDefinition . _links . config ) : '' ;
115115 // A section is enabled if it is mandatory or contains data in its section payload
116- // except for detect duplicate steps which will be hidden with no data unless overridden in config, even if mandatory
117- const enabled = ( sectionDefinition . mandatory && ( sectionDefinition . sectionType !== SectionsType . DetectDuplicate &&
118- sectionDefinition . sectionType !== SectionsType . Correction && sectionDefinition . sectionType !== SectionsType . Duplicates ) )
119- || ( isNotEmpty ( action . payload . sections ) && action . payload . sections . hasOwnProperty ( sectionId )
120- && sectionDefinition . sectionType !== SectionsType . Correction )
121- || ( isNotEmpty ( action . payload . sections ) && action . payload . sections . hasOwnProperty ( sectionId )
122- && sectionDefinition . sectionType === SectionsType . Correction && ! ( ( action . payload . sections [ sectionId ] as any ) . empty ) )
123- || ( isNotEmpty ( action . payload . sections ) && action . payload . sections . hasOwnProperty ( sectionId )
124- && ( sectionDefinition . sectionType === SectionsType . Duplicates && ( alwaysDisplayDuplicates ( ) || isNotEmpty ( ( action . payload . sections [ sectionId ] as WorkspaceitemSectionDuplicatesObject ) . potentialDuplicates ) ) )
125- ) ;
116+ let enabled = ( sectionDefinition . mandatory || ( isNotEmpty ( action . payload . sections ) && action . payload . sections . hasOwnProperty ( sectionId ) ) ) ;
117+
118+ // Duplicates will ignore mandatory and display only when "always display" is set or there is data to show
119+ if ( sectionDefinition . sectionType === SectionsType . Duplicates ) {
120+ enabled = ( alwaysDisplayDuplicates ( ) || isNotEmpty ( ( action . payload . sections [ sectionId ] as WorkspaceitemSectionDuplicatesObject ) . potentialDuplicates ) ) ;
121+ }
122+
123+ // DetectDuplicate will ignore mandatory and display only when "always display" is set or there is data to show
124+ if ( sectionDefinition . sectionType === SectionsType . DetectDuplicate ) {
125+ enabled = ( alwaysDisplayDuplicates ( ) || isNotEmpty ( ( action . payload . sections [ sectionId ] as WorkspaceitemSectionDetectDuplicateObject ) ?. matches ) ) ;
126+ }
127+
128+ // Correction will ignore mandatory and display only when there is data to show
129+ if ( sectionDefinition . sectionType === SectionsType . Correction ) {
130+ enabled = ! ( ( action . payload . sections [ sectionId ] as any ) ?. empty ) ;
131+ }
132+
126133 let sectionData ;
127134 if ( sectionDefinition . sectionType !== SectionsType . SubmissionForm ) {
128135 sectionData = ( isNotUndefined ( action . payload . sections ) && isNotUndefined ( action . payload . sections [ sectionId ] ) ) ? action . payload . sections [ sectionId ] : Object . create ( null ) ;
0 commit comments