Skip to content

Commit 65bd689

Browse files
authored
fix: make chat room an overrideable property of Session (ietf-tools#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
1 parent 04fbb8c commit 65bd689

6 files changed

Lines changed: 35 additions & 3 deletions

File tree

ietf/meeting/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class SchedulingEventInline(admin.TabularInline):
9797

9898
class SessionAdmin(admin.ModelAdmin):
9999
list_display = [
100-
"meeting", "name", "group_acronym", "purpose", "attendees", "has_onsite_tool", "requested", "current_status"
100+
"meeting", "name", "group_acronym", "purpose", "attendees", "has_onsite_tool", "chat_room", "requested", "current_status"
101101
]
102102
list_filter = ["purpose", "meeting", ]
103103
raw_id_fields = ["meeting", "group", "materials", "joint_with_groups", "tombstone_for"]

ietf/meeting/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ class Meta:
744744
model = Session
745745
fields = (
746746
'purpose', 'name', 'short', 'type', 'requested_duration',
747-
'on_agenda', 'agenda_note', 'has_onsite_tool', 'remote_instructions',
747+
'on_agenda', 'agenda_note', 'has_onsite_tool', 'chat_room', 'remote_instructions',
748748
'attendees', 'comments',
749749
)
750750
labels = {'requested_duration': 'Length'}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright The IETF Trust 2023, All Rights Reserved
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('meeting', '0003_populate_session_has_onsite_tool'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='session',
15+
name='chat_room',
16+
field=models.CharField(blank=True, help_text='Name of Zulip stream, if different from group acronym', max_length=32),
17+
),
18+
]

ietf/meeting/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ class Session(models.Model):
10521052
remote_instructions = models.CharField(blank=True,max_length=1024)
10531053
on_agenda = models.BooleanField(default=True, help_text='Is this session visible on the meeting agenda?')
10541054
has_onsite_tool = models.BooleanField(default=False, help_text="Does this session use the officially supported onsite and remote tooling?")
1055+
chat_room = models.CharField(blank=True, max_length=32, help_text='Name of Zulip stream, if different from group acronym')
10551056

10561057
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)
10571058

@@ -1285,7 +1286,10 @@ def agenda_file(self):
12851286
return self._agenda_file
12861287

12871288
def chat_room_name(self):
1288-
if self.type_id=='plenary':
1289+
if self.chat_room:
1290+
return self.chat_room
1291+
# At some point, add a migration to add "plenary" chat room name to existing sessions in the database.
1292+
elif self.type_id=='plenary':
12891293
return 'plenary'
12901294
else:
12911295
return self.group_at_the_time().acronym

ietf/meeting/tests_models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,11 @@ def test_chat_archive_url(self):
138138
self.assertEqual(session_with_jabber.chat_archive_url(), 'https://www.ietf.org/jabber/logs/fakeacronym?C=M;O=D')
139139
chatlog = SessionPresentationFactory(session=session_with_jabber, document__type_id='chatlog').document
140140
self.assertEqual(session_with_jabber.chat_archive_url(), chatlog.get_href())
141+
142+
def test_chat_room_name(self):
143+
session = SessionFactory(group__acronym='xyzzy')
144+
self.assertEqual(session.chat_room_name(), 'xyzzy')
145+
session.type_id = 'plenary'
146+
self.assertEqual(session.chat_room_name(), 'plenary')
147+
session.chat_room = 'fnord'
148+
self.assertEqual(session.chat_room_name(), 'fnord')

ietf/meeting/tests_views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3975,6 +3975,7 @@ def test_edit_session(self):
39753975
'remote_instructions': 'Do this do that',
39763976
'attendees': '103',
39773977
'comments': 'So much to say',
3978+
'chat_room': 'xyzzy',
39783979
}
39793980
r = self.client.post(url, post_data)
39803981
self.assertNoFormPostErrors(r)
@@ -3989,6 +3990,7 @@ def test_edit_session(self):
39893990
self.assertEqual(session.remote_instructions, 'Do this do that')
39903991
self.assertEqual(session.attendees, 103)
39913992
self.assertEqual(session.comments, 'So much to say')
3993+
self.assertEqual(session.chat_room, 'xyzzy')
39923994

39933995
# Verify return to correct schedule when sched query parameter is present
39943996
other_schedule = ScheduleFactory(meeting=session.meeting)

0 commit comments

Comments
 (0)