NPE for preview of draft file with retention period#12434
Conversation
| #{bundle['file.metadataTab.fileMetadata.publicationDate.label']} | ||
| </th> | ||
| <td>#{(empty FilePage.file.embargo) and !(empty FilePage.file.released) and !(empty FilePage.file.retention) ? ''.concat(FilePage.file.publicationDateFormattedYYYYMMDD).concat('; ') : ''} | ||
| <td>#{(empty FilePage.file.embargo) and FilePage.file.released and !(empty FilePage.file.retention) ? FilePage.file.publicationDateFormattedYYYYMMDD : ''} |
There was a problem hiding this comment.
I think the root cause is not addressed by this fix, although I can see why it would work. Since FilePage.file.released is a boolean !(empty FilePage.file.released) is always true (false is not empty). So the first branch with the concats runs when the publication date is null. I think if you replace that with FilePage.file.released it should work without needing to split adding the ; into a separate step. (Unless we have a bug where the released is true and the pub date is still null. If so, testing if the pub date is null might be a better choice.)
There was a problem hiding this comment.
There was a problem hiding this comment.
I'm sure the Draft: is being added to the beginning of separate messages for the embargo and retain logic. If this is common and confusing enough, code could probably be added to suppress Draft: in the retained message if the file is also embargoed. Probably a separate issue/PR though. I'll go ahead and approve this.


What this PR does / why we need it:
Which issue(s) this PR closes:
Special notes for your reviewer:
The change was suggested by copilot, it fixes the reported problem but I'm pretty clueless.
Suggestions on how to test this:
See issue
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?:
Additional documentation: