Skip to content

Commit f7737e8

Browse files
authored
check prereg_links exists before raising exception (for current workflow it looks to be impossible 'why_no_prereg' be empty and 'prereg_links' exists simultaniously) (#11492)
1 parent d0ab193 commit f7737e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/preprints/serializers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ def update(self, preprint, validated_data):
325325

326326
updated_has_prereg_links = validated_data.get('has_prereg_links', preprint.has_prereg_links)
327327
updated_why_no_prereg = validated_data.get('why_no_prereg', preprint.why_no_prereg)
328+
prereg_links = validated_data.get('prereg_links', preprint.prereg_links)
328329

329330
if updated_has_coi is False and updated_conflict_statement:
330331
raise exceptions.ValidationError(
@@ -341,7 +342,7 @@ def update(self, preprint, validated_data):
341342
detail='Cannot provide data links when has_data_links is set to "no".',
342343
)
343344

344-
if updated_has_prereg_links != 'no' and updated_why_no_prereg:
345+
if updated_has_prereg_links != 'no' and (updated_why_no_prereg and not prereg_links):
345346
raise exceptions.ValidationError(
346347
detail='You cannot edit this statement while your prereg links availability is set to true or is unanswered.',
347348
)

0 commit comments

Comments
 (0)