Skip to content

Commit d626a96

Browse files
committed
Merged in [18927] from jennifer@painless-security.com:
Drop parent group filter keyword from special group agenda items. Fixes ietf-tools#3115. - Legacy-Id: 18943 Note: SVN reference [18927] has been migrated to Git commit 516abc5
2 parents 5ecd470 + 516abc5 commit d626a96

3 files changed

Lines changed: 82 additions & 22 deletions

File tree

ietf/meeting/helpers.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ def preprocess_assignments_for_agenda(assignments_queryset, meeting, extra_prefe
243243

244244
return assignments
245245

246+
def is_regular_agenda_filter_group(group):
247+
"""Should this group appear in the 'regular' agenda filter button lists?"""
248+
return group.type_id in ('wg', 'rg', 'ag', 'rag', 'iab', 'program')
249+
246250
def tag_assignments_with_filter_keywords(assignments):
247251
"""Add keywords for agenda filtering
248252
@@ -261,7 +265,12 @@ def filter_keywords_for_session(session):
261265
keywords.add('bof')
262266
keywords.add(group.acronym.lower())
263267
area = getattr(group, 'historic_parent', group.parent)
264-
if area is not None:
268+
269+
# Only sessions belonging to "regular" groups should respond to the
270+
# parent group filter keyword (often the 'area'). This must match
271+
# the test used by the agenda() view to decide whether a group
272+
# gets an area or non-area filter button.
273+
if is_regular_agenda_filter_group(group) and area is not None:
265274
keywords.add(area.acronym.lower())
266275
office_hours_match = re.match(r'^ *\w+(?: +\w+)* +office hours *$', session.name, re.IGNORECASE)
267276
if office_hours_match is not None:

ietf/meeting/tests_js.py

Lines changed: 68 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -649,44 +649,95 @@ def assert_weekview_item_visibility(self, visible_groups=None):
649649
else:
650650
self.assertIsNone(item_div, 'Unexpected weekview entry for "%s" (%s)' % (label, item.slug()))
651651

652+
@staticmethod
653+
def open_agenda_filter_ui(wait):
654+
"""Click the 'customize' anchor to reveal the group buttons"""
655+
customize_anchor = wait.until(
656+
expected_conditions.element_to_be_clickable(
657+
(By.CSS_SELECTOR, '#accordion a[data-toggle="collapse"]')
658+
)
659+
)
660+
customize_anchor.click()
661+
return customize_anchor
662+
663+
@staticmethod
664+
def get_agenda_filter_group_button(wait, group_acronym):
665+
return wait.until(
666+
expected_conditions.element_to_be_clickable(
667+
(By.CSS_SELECTOR, 'button.pickview.%s' % group_acronym)
668+
)
669+
)
670+
652671
def test_agenda_view_group_filter_toggle(self):
653672
"""Clicking a group toggle enables/disables agenda filtering"""
673+
wait = WebDriverWait(self.driver, 2)
654674
group_acronym = 'mars'
655675

656676
self.login()
657677
url = self.absreverse('ietf.meeting.views.agenda')
658678
self.driver.get(url)
659679

660-
# Click the 'customize' anchor to reveal the group buttons
661-
customize_anchor = WebDriverWait(self.driver, 2).until(
662-
expected_conditions.element_to_be_clickable(
663-
(By.CSS_SELECTOR, '#accordion a[data-toggle="collapse"]')
664-
)
665-
)
666-
customize_anchor.click()
680+
self.open_agenda_filter_ui(wait)
667681

668682
# Click the group button
669-
group_button = WebDriverWait(self.driver, 2).until(
670-
expected_conditions.element_to_be_clickable(
671-
(By.CSS_SELECTOR, 'button.pickview.%s' % group_acronym)
672-
)
673-
)
683+
group_button = self.get_agenda_filter_group_button(wait, group_acronym)
674684
group_button.click()
675685

676686
# Check visibility
677687
self.assert_agenda_item_visibility([group_acronym])
678688

679689
# Click the group button again
680-
group_button = WebDriverWait(self.driver, 2).until(
681-
expected_conditions.element_to_be_clickable(
682-
(By.CSS_SELECTOR, 'button.pickview.%s' % group_acronym)
683-
)
684-
)
685690
group_button.click()
686691

687692
# Check visibility
688693
self.assert_agenda_item_visibility()
689694

695+
def test_agenda_view_team_group_filter_toggle(self):
696+
"""'Team' group sessions should not respond to area filter button
697+
698+
Sessions belonging to 'team' groups should not respond to their parent buttons. This prevents,
699+
e.g., 'hackathon', or 'tools' group sessions from being shown/hidden when their parent group
700+
filter button is clicked.
701+
"""
702+
wait = WebDriverWait(self.driver, 10)
703+
meeting = Meeting.objects.get(type_id='ietf')
704+
parent_group = GroupFactory(type_id='area')
705+
other_group = GroupFactory(parent=parent_group, type_id='wg')
706+
hackathon_group = GroupFactory(acronym='hackathon', type_id='team', parent=parent_group)
707+
708+
# hackathon session
709+
SessionFactory(
710+
meeting=meeting,
711+
type_id='other',
712+
group=hackathon_group,
713+
name='Hackathon',
714+
)
715+
716+
# session to cause the parent_group to appear in the filter UI tables
717+
SessionFactory(meeting=meeting, type_id='regular', group=other_group)
718+
719+
self.login()
720+
url = self.absreverse('ietf.meeting.views.agenda')
721+
self.driver.get(url)
722+
723+
self.open_agenda_filter_ui(wait)
724+
725+
self.get_agenda_filter_group_button(wait, 'mars').click()
726+
self.assert_agenda_item_visibility(['mars'])
727+
728+
# enable hackathon group
729+
group_button = self.get_agenda_filter_group_button(wait, 'hackathon')
730+
group_button.click()
731+
self.assert_agenda_item_visibility(['mars', 'hackathon'])
732+
733+
# disable hackathon group
734+
group_button.click()
735+
self.assert_agenda_item_visibility(['mars'])
736+
737+
# clicking area should not show the hackathon
738+
self.get_agenda_filter_group_button(wait, parent_group.acronym).click()
739+
self.assert_agenda_item_visibility(['mars', other_group.acronym])
740+
690741
def test_agenda_view_group_filter_toggle_without_replace_state(self):
691742
"""Toggle should function for browsers without window.history.replaceState"""
692743
group_acronym = 'mars'

ietf/meeting/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
from ietf.meeting.helpers import get_modified_from_assignments
6565
from ietf.meeting.helpers import get_wg_list, find_ads_for_meeting
6666
from ietf.meeting.helpers import get_meeting, get_ietf_meeting, get_current_ietf_meeting_num
67-
from ietf.meeting.helpers import get_schedule, schedule_permissions
67+
from ietf.meeting.helpers import get_schedule, schedule_permissions, is_regular_agenda_filter_group
6868
from ietf.meeting.helpers import preprocess_assignments_for_agenda, read_agenda_file
6969
from ietf.meeting.helpers import filter_keywords_for_session, tag_assignments_with_filter_keywords
7070
from ietf.meeting.helpers import convert_draft_to_pdf, get_earliest_session_date
@@ -1375,7 +1375,7 @@ def agenda(request, num=None, name=None, base=None, ext=None, owner=None, utc=""
13751375
groups = [a.session.historic_group for a in filtered_assignments
13761376
if a.session
13771377
and a.session.historic_group
1378-
and a.session.historic_group.type_id in ('wg', 'rg', 'ag', 'rag', 'iab', 'program')
1378+
and is_regular_agenda_filter_group(a.session.historic_group)
13791379
and a.session.historic_group.historic_parent]
13801380
group_parents = []
13811381
for g in groups:
@@ -1467,7 +1467,7 @@ def agenda(request, num=None, name=None, base=None, ext=None, owner=None, utc=""
14671467
if len(category) > 0]
14681468

14691469
is_current_meeting = (num is None) or (num == get_current_ietf_meeting_num())
1470-
1470+
14711471
rendered_page = render(request, "meeting/"+base+ext, {
14721472
"schedule": schedule,
14731473
"filtered_assignments": filtered_assignments,
@@ -3377,7 +3377,7 @@ def upcoming(request):
33773377
# using group / parent instead of historic_group / historic_parent
33783378
groups = [s.group for s in interim_sessions
33793379
if s.group
3380-
and s.group.type_id in ('wg', 'rg', 'ag', 'rag', 'iab', 'program')
3380+
and is_regular_agenda_filter_group(s.group)
33813381
and s.group.parent]
33823382
group_parents = {g.parent for g in groups if g.parent}
33833383
seen = set()

0 commit comments

Comments
 (0)