diff --git a/openreview/venue/group.py b/openreview/venue/group.py index 13e7dc44f..14d9b5eba 100644 --- a/openreview/venue/group.py +++ b/openreview/venue/group.py @@ -188,6 +188,7 @@ def create_venue_group(self): 'desk_rejection_name': { 'value': 'Desk_Rejection'}, 'desk_rejection_email_pcs': { 'value': self.venue.submission_stage.email_pcs_on_desk_reject }, 'desk_rejected_submission_reveal_authors': { 'value': self.venue.submission_stage.desk_rejected_submission_reveal_authors }, + 'deletion_expiration_id': { 'value': self.venue.get_invitation_id('Deletion_Expiration') }, 'automatic_reviewer_assignment': { 'value': self.venue.automatic_reviewer_assignment }, 'decision_heading_map': { 'value': self.venue.decision_heading_map }, 'reviewers_message_submission_id': { 'value': self.venue.get_message_id(number='{number}') }, diff --git a/openreview/venue/invitation.py b/openreview/venue/invitation.py index 7519bb894..66e632c40 100644 --- a/openreview/venue/invitation.py +++ b/openreview/venue/invitation.py @@ -310,6 +310,42 @@ def set_submission_deletion_invitation(self, submission_revision_stage): invitation.edit['invitation']['expdate'] = deletion_expdate self.save_invitation(invitation, replacement=False) + + expire_invitation = Invitation ( + id=self.venue.get_invitation_id('Deletion_Expiration'), + invitees = [venue_id], + signatures = [venue_id], + readers = ['everyone'], + writers = [venue_id], + edit = { + 'signatures': [venue_id], + 'readers': [venue_id], + 'writers': [venue_id], + 'ddate': { + 'param': { + 'range': [ 0, 9999999999999 ], + 'optional': True, + 'deletable': True + } + }, + 'invitation': { + 'id': { + 'param': { + 'regex': self.venue.get_paper_group_prefix() + } + }, + 'signatures': [venue_id], + 'expdate': { + 'param': { + 'range': [ 0, 9999999999999 ], + 'deletable': True + } + } + } + } + ) + + self.save_invitation(expire_invitation, replacement=True) return invitation def set_post_submission_invitation(self): diff --git a/openreview/venue/process/submission_deletion_process.py b/openreview/venue/process/submission_deletion_process.py index 893264fb6..281c69ee4 100644 --- a/openreview/venue/process/submission_deletion_process.py +++ b/openreview/venue/process/submission_deletion_process.py @@ -9,10 +9,47 @@ def process(client, edit, invitation): contact = domain.content['contact']['value'] meta_invitation_id = domain.content['meta_invitation_id']['value'] sender = domain.get_content_value('message_sender') + deletion_expiration_id = domain.content['deletion_expiration_id']['value'] note = client.get_note(edit.note.id) action = 'deleted' if note.ddate else 'restored' + paper_group_id=f'{venue_id}/{submission_name}{note.number}' + authors_group_id=f'{paper_group_id}/{authors_name}' + + now = openreview.tools.datetime_millis(datetime.datetime.utcnow()) + + if action == 'deleted': + + invitations = client.get_invitations(replyForum=note.id, prefix=paper_group_id) + + for invitation in invitations: + if not invitation.id.endswith('/Deletion'): + print(f'Expiring invitation {invitation.id}') + client.post_invitation_edit( + invitations=deletion_expiration_id, + invitation=openreview.api.Invitation(id=invitation.id, + expdate=now + ) + ) + client.remove_members_from_group(authors_id, authors_group_id) + + elif action == 'restored': + + invitations = client.get_invitations(replyForum=note.id, invitation=deletion_expiration_id, expired=True) + + for expired_invitation in invitations: + print(f'Remove expiration invitation {expired_invitation.id}') + invitation_edits = client.get_invitation_edits(invitation_id=expired_invitation.id, invitation=deletion_expiration_id) + for invitation_edit in invitation_edits: + print(f'remove edit {edit.id}') + invitation_edit.ddate = now + invitation_edit.invitation.expdate = None + invitation_edit.invitation.cdate = None + client.post_edit(invitation_edit) + + client.add_members_to_group(authors_id, authors_group_id) + action_message = f'''You can restore your submission from the submission's forum: https://openreview.net/forum?id={note.forum}''' if action == 'restored': action_message = f'''To view your submission, click here: https://openreview.net/forum?id={note.forum}''' @@ -27,14 +64,6 @@ def process(client, edit, invitation): Title: {note.content['title']['value']}{note_abstract} {action_message}''' - - paper_group_id=f'{venue_id}/{submission_name}{note.number}' - authors_group_id=f'{paper_group_id}/{authors_name}' - - if action == 'restored': - client.add_members_to_group(authors_id, authors_group_id) - if action == 'deleted': - client.remove_members_from_group(authors_id, authors_group_id) #send tauthor email if edit.tauthor.lower() != 'openreview.net': diff --git a/tests/test_emnlp_conference.py b/tests/test_emnlp_conference.py index 96627b3e5..c6311093c 100644 --- a/tests/test_emnlp_conference.py +++ b/tests/test_emnlp_conference.py @@ -412,6 +412,18 @@ def test_submit_papers(self, test_client, client, openreview_client, helpers, se authors_group = openreview_client.get_group('EMNLP/2023/Conference/Authors') assert 'EMNLP/2023/Conference/Submission5/Authors' not in authors_group.members + invitation = openreview_client.get_invitation('EMNLP/2023/Conference/Submission5/-/Revision') + assert invitation.expdate and invitation.expdate < openreview.tools.datetime_millis(datetime.datetime.utcnow()) + assert invitation.invitations == [ + "EMNLP/2023/Conference/-/Revision", + "EMNLP/2023/Conference/-/Deletion_Expiration" + ] + + invitation = openreview_client.get_invitation('EMNLP/2023/Conference/Submission5/-/Deletion') + assert invitation.invitations == [ + "EMNLP/2023/Conference/-/Deletion" + ] + # restore submission deletion_edit = test_client.post_note_edit(invitation='EMNLP/2023/Conference/Submission5/-/Deletion', signatures=['EMNLP/2023/Conference/Submission5/Authors'], @@ -444,6 +456,18 @@ def test_submit_papers(self, test_client, client, openreview_client, helpers, se authors_group = openreview_client.get_group('EMNLP/2023/Conference/Authors') assert 'EMNLP/2023/Conference/Submission5/Authors' in authors_group.members + invitation = openreview_client.get_invitation('EMNLP/2023/Conference/Submission5/-/Revision') + assert invitation.expdate and invitation.expdate > openreview.tools.datetime_millis(datetime.datetime.utcnow()) + assert invitation.invitations == [ + "EMNLP/2023/Conference/-/Revision", + "EMNLP/2023/Conference/-/Deletion_Expiration" + ] + + invitation = openreview_client.get_invitation('EMNLP/2023/Conference/Submission5/-/Deletion') + assert invitation.invitations == [ + "EMNLP/2023/Conference/-/Deletion" + ] + revision_due_date = now + datetime.timedelta(days=10) revision_stage_note = pc_client.post_note(openreview.Note(