Skip to content

Commit

Permalink
expire paper invitations when paper is deleted (#2207)
Browse files Browse the repository at this point in the history
  • Loading branch information
celestemartinez authored Jun 20, 2024
1 parent a5deab5 commit 799d93b
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 8 deletions.
1 change: 1 addition & 0 deletions openreview/venue/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}') },
Expand Down
36 changes: 36 additions & 0 deletions openreview/venue/invitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
45 changes: 37 additions & 8 deletions openreview/venue/process/submission_deletion_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'''
Expand All @@ -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':
Expand Down
24 changes: 24 additions & 0 deletions tests/test_emnlp_conference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 799d93b

Please sign in to comment.