Skip to content

Commit

Permalink
InvitationResponseForm: disallow adding editor as an author.
Browse files Browse the repository at this point in the history
Adding the project's editor as an author should not be allowed.

(This would normally only be possible if the project is in
NEEDS_RESUBMISSION state.)

It would be better to have a way of completely un-assigning the
editor, but the current system doesn't have a way to handle that
(AssignEditorForm requires the project to be in NEEDS_ASSIGNMENT
state.)
  • Loading branch information
Benjamin Moody committed Sep 17, 2024
1 parent 4015f82 commit cba2580
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions physionet-django/project/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,17 @@ def clean(self):
raise forms.ValidationError(
'You are not invited.')

if cleaned_data['response'] and not cleaned_data.get('affiliation'):
raise forms.ValidationError('You must specify your affiliation.')
if cleaned_data['response']:
if self.user == self.instance.project.editor:
raise forms.ValidationError(
'You must reassign this project to another editor '
'before accepting an authorship invitation.'
)

if not cleaned_data.get('affiliation'):
raise forms.ValidationError(
'You must specify your affiliation.'
)

return cleaned_data

Expand Down

0 comments on commit cba2580

Please sign in to comment.