fix: make chat room an overrideable property of Session (#5681)

* fix: make chat room an overrideable property of Session

* test: validate that /meeting/session/<sessionid>/edit shows and sets chat room

* test: validate Session.chat_room_name
This commit is contained in:
Paul Selkirk 2023-05-24 11:26:19 -04:00 committed by GitHub
parent 04fbb8cff3
commit 65bd689daa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 3 deletions

View file

@ -97,7 +97,7 @@ class SchedulingEventInline(admin.TabularInline):
class SessionAdmin(admin.ModelAdmin):
list_display = [
"meeting", "name", "group_acronym", "purpose", "attendees", "has_onsite_tool", "requested", "current_status"
"meeting", "name", "group_acronym", "purpose", "attendees", "has_onsite_tool", "chat_room", "requested", "current_status"
]
list_filter = ["purpose", "meeting", ]
raw_id_fields = ["meeting", "group", "materials", "joint_with_groups", "tombstone_for"]

View file

@ -744,7 +744,7 @@ class SessionDetailsForm(forms.ModelForm):
model = Session
fields = (
'purpose', 'name', 'short', 'type', 'requested_duration',
'on_agenda', 'agenda_note', 'has_onsite_tool', 'remote_instructions',
'on_agenda', 'agenda_note', 'has_onsite_tool', 'chat_room', 'remote_instructions',
'attendees', 'comments',
)
labels = {'requested_duration': 'Length'}

View file

@ -0,0 +1,18 @@
# Copyright The IETF Trust 2023, All Rights Reserved
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('meeting', '0003_populate_session_has_onsite_tool'),
]
operations = [
migrations.AddField(
model_name='session',
name='chat_room',
field=models.CharField(blank=True, help_text='Name of Zulip stream, if different from group acronym', max_length=32),
),
]

View file

@ -1052,6 +1052,7 @@ class Session(models.Model):
remote_instructions = models.CharField(blank=True,max_length=1024)
on_agenda = models.BooleanField(default=True, help_text='Is this session visible on the meeting agenda?')
has_onsite_tool = models.BooleanField(default=False, help_text="Does this session use the officially supported onsite and remote tooling?")
chat_room = models.CharField(blank=True, max_length=32, help_text='Name of Zulip stream, if different from group acronym')
tombstone_for = models.ForeignKey('Session', blank=True, null=True, help_text="This session is the tombstone for a session that was rescheduled", on_delete=models.CASCADE)
@ -1285,7 +1286,10 @@ class Session(models.Model):
return self._agenda_file
def chat_room_name(self):
if self.type_id=='plenary':
if self.chat_room:
return self.chat_room
# At some point, add a migration to add "plenary" chat room name to existing sessions in the database.
elif self.type_id=='plenary':
return 'plenary'
else:
return self.group_at_the_time().acronym

View file

@ -138,3 +138,11 @@ class SessionTests(TestCase):
self.assertEqual(session_with_jabber.chat_archive_url(), 'https://www.ietf.org/jabber/logs/fakeacronym?C=M;O=D')
chatlog = SessionPresentationFactory(session=session_with_jabber, document__type_id='chatlog').document
self.assertEqual(session_with_jabber.chat_archive_url(), chatlog.get_href())
def test_chat_room_name(self):
session = SessionFactory(group__acronym='xyzzy')
self.assertEqual(session.chat_room_name(), 'xyzzy')
session.type_id = 'plenary'
self.assertEqual(session.chat_room_name(), 'plenary')
session.chat_room = 'fnord'
self.assertEqual(session.chat_room_name(), 'fnord')

View file

@ -3975,6 +3975,7 @@ class EditTests(TestCase):
'remote_instructions': 'Do this do that',
'attendees': '103',
'comments': 'So much to say',
'chat_room': 'xyzzy',
}
r = self.client.post(url, post_data)
self.assertNoFormPostErrors(r)
@ -3989,6 +3990,7 @@ class EditTests(TestCase):
self.assertEqual(session.remote_instructions, 'Do this do that')
self.assertEqual(session.attendees, 103)
self.assertEqual(session.comments, 'So much to say')
self.assertEqual(session.chat_room, 'xyzzy')
# Verify return to correct schedule when sched query parameter is present
other_schedule = ScheduleFactory(meeting=session.meeting)