Skip to content

feat: Add disclaimer banner for unadopted I-Ds and non-IETF RFCs #6786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c492f3e
feat: Add disclaimer banners for unadopted I-Ds and non-IETF RFCs
larseggert Nov 4, 2023
38e16e6
Merge branch 'main' into fix-6539
larseggert Dec 8, 2023
5c4709a
Merge branch 'main' into fix-6539
larseggert Dec 12, 2023
3c4c069
Fixes
larseggert Dec 13, 2023
26fbd02
Merge branch 'main' into fix-6539
larseggert Dec 15, 2023
96fb781
Add test
larseggert Dec 15, 2023
5adbd08
Use BofreqFactory
larseggert Dec 15, 2023
6a295da
ci: merge pull request #6589 from larseggert/fix-6539
rjsparks Dec 15, 2023
f6be6ce
Fix disclaimer logic
larseggert Dec 18, 2023
40f750f
Merge pull request #6797 from larseggert/fix-disclaimer
rjsparks Dec 18, 2023
5c2b506
fix: Wording changes from stream owners
larseggert Dec 20, 2023
9f0a97c
fix: Only insert <wbr> when there isn't a space before or after (#6821)
larseggert Dec 20, 2023
94b405f
Merge pull request #6822 from larseggert/fix-disclaimer-wording
rjsparks Dec 20, 2023
8e050ff
Merge pull request #6838 from ietf-tools/main
rjsparks Dec 22, 2023
3e699df
ci: Merge branch 'main' into feat/clarity
rjsparks Jan 8, 2024
c73201b
fix: Remove debug info from template (#6897)
larseggert Jan 8, 2024
3411938
chore: merge remote-tracking branch 'ietf-tools/main' into feat/clarity
rjsparks May 15, 2024
c495f29
Merge remote-tracking branch 'ietf-tools/main' into feat/clarity
rjsparks May 16, 2024
6d1f0f8
fix: remove link to Warren's draft from disclaimer text (#7429)
rjsparks May 16, 2024
f1f3490
Merge remote-tracking branch 'ietf-tools/main' into feat/clarity
rjsparks May 16, 2024
167b5ce
Merge branch 'main' into feat/clarity
rjsparks May 23, 2024
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
25 changes: 25 additions & 0 deletions ietf/doc/templatetags/ietf_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,3 +933,28 @@ def url_for_path(path):
return f"{settings.IETF_ID_ARCHIVE_URL}{path.name}"
else:
return "#"


@register.filter
def is_in_stream(doc):
"""
Check if the doc is in one of the states in it stream that
indicate that is actually adopted, i.e., part of the stream.
(There are various "candidate" states that necessitate this
filter.)
"""
if not doc.stream:
return False
stream = doc.stream.slug
state = doc.get_state_slug(f"draft-stream-{doc.stream.slug}")
if not state:
return True
if stream == "ietf":
return state not in ["wg-cand", "c-adopt"]
elif stream == "irtf":
return state != "candidat"
elif stream == "iab":
return state not in ["candidat", "diff-org"]
elif stream == "editorial":
return True
return False
31 changes: 28 additions & 3 deletions ietf/doc/templatetags/tests_ietf_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,20 @@
IndividualDraftFactory,
CharterFactory,
NewRevisionDocEventFactory,
StatusChangeFactory,
RgDraftFactory,
EditorialDraftFactory,
WgDraftFactory,
ConflictReviewFactory,
BofreqFactory,
StatementFactory,
)
from ietf.doc.models import DocEvent
from ietf.doc.templatetags.ietf_filters import urlize_ietf_docs, is_valid_url
from ietf.doc.templatetags.ietf_filters import (
urlize_ietf_docs,
is_valid_url,
is_in_stream,
)
from ietf.person.models import Person
from ietf.utils.test_utils import TestCase

Expand All @@ -19,13 +30,28 @@


class IetfFiltersTests(TestCase):
def test_is_in_stream(self):
for draft in [
IndividualDraftFactory(),
CharterFactory(),
StatusChangeFactory(),
ConflictReviewFactory(),
StatementFactory(),
BofreqFactory(),
]:
self.assertFalse(is_in_stream(draft))
for draft in [RgDraftFactory(), WgDraftFactory(), EditorialDraftFactory()]:
self.assertTrue(is_in_stream(draft))
for stream in ["iab", "ietf", "irtf", "ise", "editorial"]:
self.assertTrue(is_in_stream(IndividualDraftFactory(stream_id=stream)))

def test_is_valid_url(self):
cases = [(settings.IDTRACKER_BASE_URL, True), ("not valid", False)]
for url, result in cases:
self.assertEqual(is_valid_url(url), result)

def test_urlize_ietf_docs(self):
rfc = WgRfcFactory(rfc_number=123456,std_level_id="bcp")
rfc = WgRfcFactory(rfc_number=123456, std_level_id="bcp")
rfc.save_with_history(
[
DocEvent.objects.create(
Expand Down Expand Up @@ -57,7 +83,6 @@ def test_urlize_ietf_docs(self):

cases = [
("no change", "no change"),

# TODO: rework subseries when we add them
# ("bCp123456", '<a href="/doc/bcp123456/">bCp123456</a>'),
# ("Std 00123456", '<a href="/doc/std123456/">Std 00123456</a>'),
Expand Down
2 changes: 1 addition & 1 deletion ietf/static/js/ietf.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ $(document)
var text = $(this)
.text();
// insert some <wbr> at strategic places
var newtext = text.replace(/([@._+])/g, "$1<wbr>");
var newtext = text.replace(/(\S)([@._+])(\S)/g, "$1$2<wbr>$3");
if (newtext === text) {
return;
}
Expand Down
28 changes: 28 additions & 0 deletions ietf/templates/doc/disclaimer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{# Copyright The IETF Trust 2016-2023, All Rights Reserved #}
{% load origin %}
{% load ietf_filters %}
{% origin %}
{% if doc.type_id == "rfc" %}
{% if doc.stream.slug != "ietf" and doc.std_level.slug|default:"unk" not in "bcp,ds,ps,std"|split:"," %}
<div class="alert alert-warning {% if document_html %}small p-2 mt-2{% endif %}" role="alert">
This RFC was published on the {{ doc.stream.desc }} stream.
This RFC is <strong>not endorsed by the IETF</strong> and has <strong>no formal standing</strong> in the
<a href="{% url 'ietf.doc.views_doc.document_main' name='rfc2026' %}">IETF standards process</a>.
</div>
{% endif %}
{% elif doc|is_in_stream %}
{% if doc.stream.slug != "ietf" and doc.std_level.slug|default:"unk" not in "bcp,ds,ps,std"|split:"," %}
<div class="alert alert-warning {% if document_html %}small p-2 mt-2{% endif %}" role="alert">
This document is an Internet-Draft (I-D) that has been submitted to the {{ doc.stream.desc }} stream.
This I-D is <strong>not endorsed by the IETF</strong> and has <strong>no formal standing</strong> in the
<a href="{% url 'ietf.doc.views_doc.document_main' name='rfc2026' %}">IETF standards process</a>.
</div>
{% endif %}
{% else %}
<div class="alert alert-warning {% if document_html %}small p-2 mt-2{% endif %}" role="alert">
This document is an Internet-Draft (I-D).
Anyone may submit an I-D to the IETF.
This I-D is <strong>not endorsed by the IETF</strong> and has <strong>no formal standing</strong> in the
<a href="{% url 'ietf.doc.views_doc.document_main' name='rfc2026' %}">IETF standards process</a>.
</div>
{% endif %}
1 change: 1 addition & 0 deletions ietf/templates/doc/document_draft.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
{% origin %}
{{ top|safe }}
{% include "doc/revisions_list.html" with document_html=document_html %}
{% include "doc/disclaimer.html" with document_html=document_html %}
<div id="doc-timeline"></div>
{% if doc.rev != latest_rev %}
<div class="alert alert-warning my-3">The information below is for an old version of the document.</div>
Expand Down
5 changes: 4 additions & 1 deletion ietf/templates/doc/document_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
{% if doc.became_rfc %}
<div{% if document_html %} class="alert alert-warning small"{% endif %}>This is an older version of an Internet-Draft that was ultimately published as <a href="{% if document_html %}{% url 'ietf.doc.views_doc.document_html' name=doc.became_rfc.name %}{% else %}{% url 'ietf.doc.views_doc.document_main' name=doc.became_rfc.name %}{% endif %}">{{doc.became_rfc.name|prettystdname}}</a>.</div>
{% elif snapshot and doc.rev != latest_rev %}
<div{% if document_html %} class="alert alert-warning small"{% endif %}>This is an older version of an Internet-Draft whose latest revision state is "{{ doc.doc.get_state }}".</div>
<div{% if document_html %} class="alert alert-warning small p-2 mt-2"{% endif %}>This is an older version of an Internet-Draft whose latest revision state is "{{ doc.doc.get_state }}".</div>
{% else %}
<span class="{% if doc.get_state_slug == 'active' %}text-success{% elif doc.get_state_slug == 'expired' or doc.get_state_slug == 'repl' %}text-danger{% endif %}">{% if snapshot and doc.rev == latest_rev %}{{ doc.doc.get_state }}{% else %}{{ doc.get_state }}{% endif %} Internet-Draft</span>
{% if submission %}({{ submission|safe }}){% endif %}
Expand All @@ -75,6 +75,9 @@
Expired &amp; archived
</div>
{% endif %}
{% if document_html %}
{% include "doc/disclaimer.html" with document_html=document_html %}
{% endif %}
</td>
</tr>
{% if document_html %}
Expand Down
1 change: 1 addition & 0 deletions ietf/templates/doc/document_rfc.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{% block content %}
{% origin %}
{{ top|safe }}
{% include "doc/disclaimer.html" with document_html=document_html %}
<div id="doc-timeline"></div>
<table class="table table-sm table-borderless">
{% include "doc/document_info.html" %}
Expand Down
Loading