Skip to content

Commit

Permalink
Chat feature: enable chat in the venue request form (#2029)
Browse files Browse the repository at this point in the history
* enable chat in the venue request form

* configure tabs

* fix path

* change signatures to be items

* remove test

* fix test

* check if buttons are enabled

* fix process function

* send email notification for the first chat and every 5 new chat comments

* use chat branch

* add tag invitation to post emojis

* rename emoji invitation

* add writers back

* Update openreview/venue/invitation.py

Co-authored-by: Zach Bialecki <[email protected]>

* filter tags by tmdate

* fix test

* send notifications every 4 hours and disable the chat if the user request it

* remove checkout branch

* Update chat tab label

* Update openreview/venue/process/chat_comment_process.py

Co-authored-by: celestemartinez <[email protected]>

* Update openreview/venue/process/chat_comment_process.py

Co-authored-by: celestemartinez <[email protected]>

* Update openreview/venue/process/chat_date_comment_process.py

Co-authored-by: celestemartinez <[email protected]>

* fix typo

* Update openreview/api/client.py

Co-authored-by: carlosmondra <[email protected]>

* use an invitation to post a message

* add link to the doc

* increase version number

---------

Co-authored-by: Zach Bialecki <[email protected]>
Co-authored-by: Zach Bialecki <[email protected]>
Co-authored-by: celestemartinez <[email protected]>
Co-authored-by: carlosmondra <[email protected]>
  • Loading branch information
5 people authored May 8, 2024
1 parent 87b53b4 commit c76623f
Show file tree
Hide file tree
Showing 12 changed files with 1,010 additions and 278 deletions.
1 change: 1 addition & 0 deletions openreview/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
from .client import Invitation
from .client import Edge
from .client import Group
from .client import Tag
138 changes: 136 additions & 2 deletions openreview/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,22 @@ def get_group_edit(self, id):
n = response.json()['edits'][0]
return Edit.from_json(n)

def get_tags(self, id = None, invitation = None, forum = None, signature = None, tag = None, limit = None, offset = None, with_count=False):
def post_tag(self, tag):
"""
Posts the tag.
:param tag: Tag to be posted
:type tag: Tag
:return Tag: The posted Tag
"""
response = self.session.post(self.tags_url, json = tag.to_json(), headers = self.headers)
response = self.__handle_response(response)

return Tag.from_json(response.json())


def get_tags(self, id = None, invitation = None, forum = None, signature = None, tag = None, limit = None, offset = None, with_count=False, mintmdate=None):
"""
Gets a list of Tag objects based on the filters provided. The Tags that will be returned match all the criteria passed in the parameters.
Expand Down Expand Up @@ -1404,6 +1419,8 @@ def get_tags(self, id = None, invitation = None, forum = None, signature = None,
params['limit'] = limit
if offset is not None:
params['offset'] = offset
if mintmdate is not None:
params['mintmdate'] = mintmdate

response = self.session.get(self.tags_url, params=tools.format_params(params), headers = self.headers)
response = self.__handle_response(response)
Expand Down Expand Up @@ -3063,6 +3080,123 @@ def transform_to_anon_ids(self, elements):
elements[index] = self.anon_members[self.members.index(element)]
else:
elements[index] = element
return elements
return elements


class Tag(object):
"""
:param tag: Content of the tag
:type tag: str
:param invitation: Invitation id
:type invitation: str
:param readers: List of readers in the Invitation, each reader is a Group id
:type readers: list[str]
:param signatures: List of signatures in the Invitation, each signature is a Group id
:type signatures: list[str]
:param id: Tag id
:type id: str, optional
:param cdate: Creation date
:type cdate: int, optional
:param tcdate: True creation date
:type tcdate: int, optional
:param ddate: Deletion date
:type ddate: int, optional
:param forum: Forum id
:type forum: str, optional
:param replyto: Note id
:type replyto: list[str], optional
:param nonreaders: List of nonreaders in the Invitation, each nonreader is a Group id
:type nonreaders: list[str], optional
"""
def __init__(self, tag, invitation, signatures, readers=None, id=None, cdate=None, tcdate=None, tmdate=None, ddate=None, forum=None, replyto=None, nonreaders=None):
self.id = id
self.cdate = cdate
self.tcdate = tcdate
self.tmdate = tmdate
self.ddate = ddate
self.tag = tag
self.forum = forum
self.invitation = invitation
self.replyto = replyto
self.readers = readers
self.nonreaders = [] if nonreaders is None else nonreaders
self.signatures = signatures

def to_json(self):
"""
Converts Tag instance to a dictionary. The instance variable names are the keys and their values the values of the dictinary.
:return: Dictionary containing all the parameters of a Tag instance
:rtype: dict
"""

body = {}

if self.id:
body['id'] = self.id

if self.cdate:
body['cdate'] = self.cdate

if self.ddate:
body['ddate'] = self.ddate

if self.tag:
body['tag'] = self.tag

if self.forum:
body['forum'] = self.forum

if self.invitation:
body['invitation'] = self.invitation

if self.replyto:
body['replyto'] = self.replyto

if self.readers:
body['readers'] = self.readers

if self.nonreaders:
body['nonreaders'] = self.nonreaders

if self.signatures:
body['signatures'] = self.signatures

return body

@classmethod
def from_json(Tag, t):
"""
Creates a Tag object from a dictionary that contains keys values equivalent to the name of the instance variables of the Tag class
:param n: Dictionary containing key-value pairs, where the keys values are equivalent to the name of the instance variables in the Tag class
:type n: dict
:return: Tag whose instance variables contain the values from the dictionary
:rtype: Tag
"""
tag = Tag(
id = t.get('id'),
cdate = t.get('cdate'),
tcdate = t.get('tcdate'),
tmdate = t.get('tmdate'),
ddate = t.get('ddate'),
tag = t.get('tag'),
forum = t.get('forum'),
invitation = t.get('invitation'),
replyto = t.get('replyto'),
readers = t.get('readers'),
nonreaders = t.get('nonreaders'),
signatures = t.get('signatures'),
)
return tag

def __repr__(self):
content = ','.join([("%s = %r" % (attr, value)) for attr, value in vars(self).items()])
return 'Tag(' + content + ')'

def __str__(self):
pp = pprint.PrettyPrinter()
return pp.pformat(vars(self))


5 changes: 4 additions & 1 deletion openreview/conference/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,8 @@ def get_comment_stage(request_forum):

email_pcs = request_forum.content.get('email_program_chairs_about_official_comments', '') == 'Yes, email PCs for each official comment made in the venue'

enable_chat = request_forum.content.get('enable_chat_between_committee_members', '') == 'Yes, enable chat between committee members'

return openreview.stages.CommentStage(
start_date=commentary_start_date,
end_date=commentary_end_date,
Expand All @@ -937,7 +939,8 @@ def get_comment_stage(request_forum):
email_pcs=email_pcs,
check_mandatory_readers=True,
readers=readers,
invitees=invitees
invitees=invitees,
enable_chat=enable_chat
)

def get_registration_stages(request_forum, venue):
Expand Down
57 changes: 56 additions & 1 deletion openreview/stages/venue_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,8 @@ def __init__(self,
only_accepted=False,
check_mandatory_readers=False,
readers=[],
invitees=[]):
invitees=[],
enable_chat=False):

self.official_comment_name = official_comment_name if official_comment_name else 'Official_Comment'
self.public_name = 'Public_Comment'
Expand All @@ -974,6 +975,7 @@ def __init__(self,
self.check_mandatory_readers=check_mandatory_readers
self.readers = readers
self.invitees = invitees
self.enable_chat = enable_chat

def get_readers(self, conference, number, api_version='1'):

Expand Down Expand Up @@ -1072,6 +1074,59 @@ def get_invitees(self, conference, number):

return invitees

def get_chat_invitees(self, conference, number):
invitees = [conference.get_id(), conference.support_user]

if conference.use_senior_area_chairs and self.Readers.SENIOR_AREA_CHAIRS_ASSIGNED in self.invitees:
invitees.append(conference.get_senior_area_chairs_id(number))

if conference.use_area_chairs and self.Readers.AREA_CHAIRS_ASSIGNED in self.invitees:
invitees.append(conference.get_area_chairs_id(number))

if self.Readers.REVIEWERS_ASSIGNED in self.invitees:
invitees.append(conference.get_reviewers_id(number))

if self.Readers.REVIEWERS_SUBMITTED in self.invitees:
invitees.append(conference.get_reviewers_id(number) + '/Submitted')

return invitees

def get_chat_signatures(self, conference, number):

committee = [conference.get_program_chairs_id()]

if conference.use_senior_area_chairs and self.Readers.SENIOR_AREA_CHAIRS_ASSIGNED in self.invitees:
committee.append(conference.get_senior_area_chairs_id(number))

if conference.use_area_chairs and self.Readers.AREA_CHAIRS_ASSIGNED in self.invitees:
committee.append(conference.get_anon_area_chair_id(number=number, anon_id='.*'))

if conference.use_secondary_area_chairs and self.Readers.AREA_CHAIRS_ASSIGNED in self.invitees:
committee.append(conference.get_anon_secondary_area_chair_id(number=number, anon_id='.*'))

if self.Readers.REVIEWERS_ASSIGNED in self.invitees or self.Readers.REVIEWERS_SUBMITTED in self.invitees:
committee.append(conference.get_anon_reviewer_id(number=number, anon_id='.*'))

return committee

def get_chat_readers(self, conference, number, api_version='1'):

readers = [conference.get_program_chairs_id()]

if conference.use_senior_area_chairs and self.Readers.SENIOR_AREA_CHAIRS_ASSIGNED in self.readers:
readers.append(conference.get_senior_area_chairs_id(number))

if conference.use_area_chairs and self.Readers.AREA_CHAIRS_ASSIGNED in self.readers:
readers.append(conference.get_area_chairs_id(number))

if self.Readers.REVIEWERS_ASSIGNED in self.readers:
readers.append(conference.get_reviewers_id(number))

if self.Readers.REVIEWERS_SUBMITTED in self.readers:
readers.append(conference.get_reviewers_id(number) + '/Submitted')

return readers

def get_mandatory_readers(self, conference, number):
readers = [conference.get_program_chairs_id()]
if conference.use_senior_area_chairs:
Expand Down
Loading

0 comments on commit c76623f

Please sign in to comment.