diff --git a/ietf/meeting/admin.py b/ietf/meeting/admin.py index 8c419e8a96..e975dd38a6 100644 --- a/ietf/meeting/admin.py +++ b/ietf/meeting/admin.py @@ -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"] diff --git a/ietf/meeting/forms.py b/ietf/meeting/forms.py index f3f660b2f7..822f56b97c 100644 --- a/ietf/meeting/forms.py +++ b/ietf/meeting/forms.py @@ -744,7 +744,7 @@ class Meta: 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'} diff --git a/ietf/meeting/migrations/0004_session_chat_room.py b/ietf/meeting/migrations/0004_session_chat_room.py new file mode 100644 index 0000000000..9879c8c42f --- /dev/null +++ b/ietf/meeting/migrations/0004_session_chat_room.py @@ -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), + ), + ] diff --git a/ietf/meeting/models.py b/ietf/meeting/models.py index a652711621..31a887e466 100644 --- a/ietf/meeting/models.py +++ b/ietf/meeting/models.py @@ -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 @@ def agenda_file(self): 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 diff --git a/ietf/meeting/tests_models.py b/ietf/meeting/tests_models.py index 2603190fe7..0ccd462715 100644 --- a/ietf/meeting/tests_models.py +++ b/ietf/meeting/tests_models.py @@ -138,3 +138,11 @@ def test_chat_archive_url(self): 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') diff --git a/ietf/meeting/tests_views.py b/ietf/meeting/tests_views.py index 449ad03a35..e65adaf0c6 100644 --- a/ietf/meeting/tests_views.py +++ b/ietf/meeting/tests_views.py @@ -3975,6 +3975,7 @@ def test_edit_session(self): '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 @@ def test_edit_session(self): 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)