Skip to content

ARR: Enable SACs/ACs to add/remove others from commenting #2381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions openreview/arr/arr.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ def set_arr_stages(self, configuration_note):
)
workflow.set_workflow()

def create_commentary_control_stage(self, cdate=None, expdate=None):
return self.invitation_builder.set_commentary_control_invitation(cdate=cdate, expdate=expdate)

def get_id(self):
return self.venue.get_id()

Expand Down
37 changes: 37 additions & 0 deletions openreview/arr/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,14 @@ def __init__(self, client_v2, venue, configuration_note, request_form_id, suppor
start_date=self.configuration_note.content.get('close_author_response_date'),
process='management/setup_rebuttal_end.py'
),
ARRStage(
type=ARRStage.Type.COMMENTARY_CONTROL,
required_fields=['setup_author_response_date', 'form_expiration_date'],
super_invitation_id=f"{self.venue_id}/-/Commentary_Control",
stage_arguments={},
start_date=self.configuration_note.content.get('setup_author_response_date'),
exp_date=self.configuration_note.content.get('form_expiration_date')
),
ARRStage(
type=ARRStage.Type.REGISTRATION_STAGE,
group_id=venue.get_reviewers_id(),
Expand Down Expand Up @@ -1171,12 +1179,14 @@ class Type(Enum):
STAGE_NOTE (2): Built-in OpenReview stage that's available on the request form
PROCESS_INVITATION (3): An invitation that stores an ARR script in the form of a process function
SUBMISSION_REVISION_STAGE (4): An invitation that allows revisions to the submission
COMMENTARY_CONTROL (5): Child invitations that allow SACs/ACs to enable or disable author commentary
"""
REGISTRATION_STAGE = 0
CUSTOM_STAGE = 1
STAGE_NOTE = 2
PROCESS_INVITATION = 3
SUBMISSION_REVISION_STAGE = 4
COMMENTARY_CONTROL = 5

class Participants(Enum):
EVERYONE = 0
Expand Down Expand Up @@ -1492,6 +1502,28 @@ def __is_same_dates(modified_millis):
writers = []
)
client_v1.post_note(stage_note)
elif self.type == ARRStage.Type.COMMENTARY_CONTROL:
submissions = venue.get_submissions()
for submission in submissions:
child_invitation = client.get_invitation(f"{venue_id}/Submission{submission.number}/-/Commentary_Control")
if __is_same_dates([
child_invitation.cdate,
child_invitation.duedate,
child_invitation.expdate,
]):
continue
client.post_invitation_edit(
invitations=meta_invitation_id,
readers=[venue_id],
writers=[venue_id],
signatures=[venue_id],
invitation=openreview.api.Invitation(
id=child_invitation.id,
cdate=openreview.tools.datetime_millis(self.start_date),
duedate=openreview.tools.datetime_millis(self.due_date),
expdate=openreview.tools.datetime_millis(self.exp_date)
)
)

def set_stage(self, client_v1, client, venue, invitation_builder, request_form_note):
# Find invitation
Expand Down Expand Up @@ -1522,6 +1554,11 @@ def set_stage(self, client_v1, client, venue, invitation_builder, request_form_n
signatures=[venue.id],
invitation=invitation
)
elif self.type == ARRStage.Type.COMMENTARY_CONTROL:
print('commentary')
print(self.start_date)
print(self.exp_date)
venue.create_commentary_control_stage(self.start_date, self.exp_date)

elif self.type == ARRStage.Type.CUSTOM_STAGE:
venue.custom_stage = openreview.stages.CustomStage(**self.stage_arguments)
Expand Down
251 changes: 251 additions & 0 deletions openreview/arr/invitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,257 @@ def set_process_invitation(self, arr_stage):

process_invitation = self.save_invitation(process_invitation, replacement=False)
return process_invitation

def set_commentary_control_invitation(self, cdate=None, expdate=None):
venue_id = self.venue.id
stage_name = "Commentary_Control"
super_invitation_id = f"{venue_id}/-/{stage_name}"

registration_content = {
"enable_author_commentary": {
"value": {
"param": {
"input": "radio",
"enum": [
"Yes",
"No"
],
"optional": False,
"type": "string"
}
},
"description": "Should authors be allowed to comment on the submission?",
"order": 11
},
}

invitees = [
venue_id,
venue_id + '/Submission${3/content/noteNumber/value}/Senior_Area_Chairs',
venue_id + '/Submission${3/content/noteNumber/value}/Area_Chairs'
]
note_readers = [
venue_id,
venue_id + '/Submission${5/content/noteNumber/value}/Senior_Area_Chairs',
venue_id + '/Submission${5/content/noteNumber/value}/Area_Chairs'
]

invitation = openreview.api.Invitation(id=super_invitation_id,
invitees=[venue_id],
readers=[venue_id],
writers=[venue_id],
signatures=[venue_id],
cdate=openreview.tools.datetime_millis(cdate) if cdate else None,
content = {
'commentary_control_process_script': {
'value': self.get_process_content('process/commentary_control_process.py')
}
},
edit={
'signatures': [venue_id],
'readers': [venue_id],
'writers': [venue_id],
'content': {
'noteNumber': {
'value': {
'param': {
'type': 'integer'
}
}
},
'noteId': {
'value': {
'param': {
'type': 'string'
}
}
},
'responseForumId': {
'value': {
'param': {
'type': 'string'
}
}
}
},
'invitation': {
'id': self.venue.get_invitation_id(stage_name, '${2/content/noteNumber/value}'),
'invitees': invitees,
'readers': invitees,
'writers': [venue_id],
'signatures': [venue_id],
'cdate': openreview.tools.datetime_millis(cdate) if cdate else None,
'expdate': openreview.tools.datetime_millis(expdate) if expdate else None,
'minReplies': 1,
'content': {
'forum': {
'value': '${4/content/noteId/value}'
}
},
'process': '''def process(client, edit, invitation):
meta_invitation = client.get_invitation(invitation.invitations[0])
script = meta_invitation.content['commentary_control_process_script']['value']
funcs = {
'openreview': openreview
}
exec(script, funcs)
funcs['process'](client, edit, invitation)
''',
'edit': {
"signatures": {
"param": {
"items": [
{
"value": venue_id + "/Program_Chairs",
"optional": True
},
{
"value": venue_id + "/Submission${7/content/noteNumber/value}/Senior_Area_Chairs",
"optional": True
},
{
"prefix": venue_id + "/Submission${7/content/noteNumber/value}/Area_Chair_.*",
"optional": True
}
]
}
},
'readers': ['${2/note/readers}'],
'writers': [venue_id],
'note': {
'id': {
'param': {
'withInvitation': self.venue.get_invitation_id(stage_name, '${6/content/noteNumber/value}'),
'optional': True
}
},
'ddate': {
'param': {
'range': [ 0, 9999999999999 ],
'optional': True,
'deletable': True
}
},
'forum': '${4/content/responseForumId/value}',
'replyto': '${4/content/responseForumId/value}',
'signatures': ['${3/signatures}'],
'readers': note_readers,
'writers': [venue_id, '${3/signatures}'],
'content': registration_content
}
}
}
}
)
self.save_invitation(invitation, replacement=True)

submissions = self.venue.get_submissions()
for submission in submissions:
readers = [
venue_id,
f"{venue_id}/Submission{submission.number}/Senior_Area_Chairs",
f"{venue_id}/Submission{submission.number}/Area_Chairs"
]
registration_parent_invitation_id = f"{venue_id}/Submission{submission.number}/-/Commentary_Control_Form"
invitation = openreview.api.Invitation(
id = registration_parent_invitation_id,
readers = ['everyone'],
writers = [venue_id],
signatures = [venue_id],
invitees = [venue_id, self.venue.support_user],
edit = {
'signatures': [venue_id],
'readers': [venue_id],
'writers': [venue_id],
'note': {
'id': {
'param': {
'withInvitation': registration_parent_invitation_id,
'optional': True
}
},
'ddate': {
'param': {
'range': [ 0, 9999999999999 ],
'optional': True,
'deletable': True
}
},
'readers': readers,
'writers': [venue_id],
'signatures': [venue_id],
'content': {
'title': {
'order': 1,
'value': {
'param': {
'type': 'string',
'maxLength': 250
}
}
},
'instructions': {
'order': 2,
'value': {
'param': {
'type': 'string',
'maxLength': 250000,
'markdown': True,
'input': 'textarea'
}
}
}
}
}
}
)
self.save_invitation(invitation, replacement=True)

registration_notes = self.client.get_notes(invitation=registration_parent_invitation_id)
if registration_notes:
print('Updating existing registration note')
forum_edit = self.client.post_note_edit(invitation = self.venue.get_meta_invitation_id(),
signatures=[venue_id],
note = openreview.api.Note(
id = registration_notes[0].id,
content = {
'instructions': { 'value': 'Use this page to enable author commenting' },
'title': { 'value': 'Setting Author Commenting'}
}
))
else:
forum_edit = self.client.post_note_edit(invitation=invitation.id,
signatures=[venue_id],
note = openreview.api.Note(
signatures = [venue_id],
content = {
'instructions': { 'value': 'Use this page to enable author commenting' },
'title': { 'value': 'Setting Author Commenting'}
}
)
)
forum_note_id = forum_edit['note']['id']
print(forum_note_id)

self.client.post_invitation_edit(
invitations=super_invitation_id,
readers=[venue_id],
writers=[venue_id],
signatures=[venue_id],
content={
'responseForumId': {
'value': forum_note_id
},
'noteNumber': {
'value': submission.number
},
'noteId': {
'value': submission.id
}
},
invitation=openreview.api.Invitation()
)


def save_invitation(self, invitation, replacement=None):
return self.venue_invitation_builder.save_invitation(invitation, replacement)
Expand Down
Loading