Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ietf/doc/templatetags/ietf_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,19 @@ def state(doc, slug):
slug = "%s-stream-%s" % (doc.type_id, doc.stream_id)
return doc.get_state(slug)


@register.filter
def is_unexpected_wg_state(doc):
"""Returns a flag indicating whether the document has an unexpected wg state."""
if not doc.type_id == "draft":
return False

draft_iesg_state = doc.get_state("draft-iesg")
draft_stream_state = doc.get_state("draft-stream-ietf")

return draft_iesg_state.slug != "idexists" and draft_stream_state is not None and draft_stream_state.slug != "sub-pub"


@register.filter
def statehelp(state):
"Output help icon with tooltip for state."
Expand Down
16 changes: 16 additions & 0 deletions ietf/doc/templatetags/tests_ietf_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
ConflictReviewFactory,
BofreqFactory,
StatementFactory,
RfcFactory,
)
from ietf.doc.models import DocEvent
from ietf.doc.templatetags.ietf_filters import (
urlize_ietf_docs,
is_valid_url,
is_in_stream,
is_unexpected_wg_state,
)
from ietf.person.models import Person
from ietf.utils.test_utils import TestCase
Expand Down Expand Up @@ -174,3 +176,17 @@ def test_urlize_ietf_docs(self):
for input, output in cases:
# debug.show("(input, urlize_ietf_docs(input), output)")
self.assertEqual(urlize_ietf_docs(input), output)

def test_is_unexpected_wg_state(self):
"""
Test that the unexpected_wg_state function works correctly
"""
# test documents with expected wg states
self.assertFalse(is_unexpected_wg_state(RfcFactory()))
self.assertFalse(is_unexpected_wg_state(WgDraftFactory (states=[('draft-stream-ietf', 'sub-pub')])))
self.assertFalse(is_unexpected_wg_state(WgDraftFactory (states=[('draft-iesg', 'idexists')])))
self.assertFalse(is_unexpected_wg_state(WgDraftFactory (states=[('draft-stream-ietf', 'wg-cand'), ('draft-iesg','idexists')])))

# test documents with unexpected wg states due to invalid combination of states
self.assertTrue(is_unexpected_wg_state(WgDraftFactory (states=[('draft-stream-ietf', 'wg-cand'), ('draft-iesg','lc-req')])))
self.assertTrue(is_unexpected_wg_state(WgDraftFactory (states=[('draft-stream-ietf', 'chair-w'), ('draft-iesg','pub-req')])))
4 changes: 4 additions & 0 deletions ietf/templates/doc/search/status_columns.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
{% person_link action_holder.person title=action_holder.role_for_doc %}{% if action_holder|action_holder_badge %} {{ action_holder|action_holder_badge }}{% endif %}{% if not forloop.last %},{% endif %}
{% endfor %}
{% endif %}
{% if doc|is_unexpected_wg_state %}
<br>
<span class="badge rounded-pill text-bg-warning">Unexpected WG state</span>
{% endif %}
{% else %}
{# RFC #}
{{ doc.std_level|safe }} RFC
Expand Down