Skip to content

Commit

Permalink
ci: merge main to release
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsparks authored Aug 24, 2023
2 parents b3a057d + 95050f3 commit 2d52398
Show file tree
Hide file tree
Showing 29 changed files with 351 additions and 130 deletions.
3 changes: 2 additions & 1 deletion ietf/doc/templatetags/ietf_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ def badgeify(blob):
(r"has issues", "warning", "exclamation-lg"),
(r"assigned", "info", "person-plus-fill"),
(r"will not review|overtaken by events|withdrawn", "secondary", "dash-lg"),
(r"no response", "warning", "question-lg"),
]
text = str(blob)

Expand All @@ -868,7 +869,7 @@ def badgeify(blob):

return mark_safe(
f"""
<span class="badge rounded-pill text-bg-{color}">
<span class="badge rounded-pill text-bg-{color} text-wrap">
<i class="bi bi-{icon}"></i> {text.capitalize()}
</span>
"""
Expand Down
2 changes: 1 addition & 1 deletion ietf/group/tests_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def test_reviewer_overview(self):
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
# We should see the new document with status of no response
self.assertContains(r, "No Response")
self.assertContains(r, "No response")
self.assertContains(r, review_req1.doc.name)
self.assertContains(r, review_req2.doc.name)
# None of the reviews should be completed this time,
Expand Down
10 changes: 9 additions & 1 deletion ietf/ipr/factories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2018-2020, All Rights Reserved
# Copyright The IETF Trust 2018-2023, All Rights Reserved
# -*- coding: utf-8 -*-


Expand Down Expand Up @@ -95,3 +95,11 @@ class Meta:
disclosure = factory.SubFactory(IprDisclosureBaseFactory)
desc = factory.Faker('sentence')

class IprDocRelFactory(factory.django.DjangoModelFactory):
class Meta:
model = IprDocRel

disclosure = factory.SubFactory(HolderIprDisclosureFactory)
document = factory.SubFactory("ietf.doc.factories.IndividualDraftFactory")
revisions = "00"
sections = ""
11 changes: 10 additions & 1 deletion ietf/ipr/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2014-2020, All Rights Reserved
# Copyright The IETF Trust 2014-2023, All Rights Reserved
# -*- coding: utf-8 -*-


Expand Down Expand Up @@ -105,6 +105,15 @@ class Meta:
}
help_texts = { 'sections': 'Sections' }

def clean(self):
cleaned_data = super().clean()
revisions = cleaned_data.get("revisions")
document = cleaned_data.get("document")
if not document.name.startswith("rfc"):
if revisions.strip() == "":
self.add_error("revisions", "Revisions of this Internet-Draft for which this disclosure is relevant must be specified.")
return cleaned_data

patent_number_help_text = "Enter one or more comma-separated patent publication or application numbers as two-letter country code and serial number, e.g.: US62/123456 or WO2017123456. Do not include thousands-separator commas in serial numbers. It is preferable to use individual disclosures for each patent, even if this field permits multiple patents to be listed, in order to get inventor, title, and date information below correct."
validate_patent_number = RegexValidator(
regex=(r"^("
Expand Down
40 changes: 39 additions & 1 deletion ietf/ipr/templatetags/ipr_filters.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Copyright The IETF Trust 2014-2020, All Rights Reserved
# Copyright The IETF Trust 2014-2023, All Rights Reserved
# -*- coding: utf-8 -*-


import debug # pyflakes: ignore

from django import template
from django.utils.html import format_html

from ietf.doc.models import NewRevisionDocEvent

register = template.Library()


Expand All @@ -26,3 +30,37 @@ def render_message_for_history(msg):
@register.filter
def to_class_name(value):
return value.__class__.__name__

def draft_rev_at_time(iprdocrel):
draft = iprdocrel.document.document
event = iprdocrel.disclosure.get_latest_event_posted()
if event is None:
return ("","The Internet-Draft's revision at the time this disclosure was posted could not be determined.")
time = event.time
if not NewRevisionDocEvent.objects.filter(doc=draft).exists():
return ("","The Internet-Draft's revision at the time this disclosure was posted could not be determined.")
rev_event_before = NewRevisionDocEvent.objects.filter(doc=draft, time__lte=time).order_by('-time').first()
if rev_event_before is None:
return ("","The Internet-Draft's initial submission was after this disclosure was posted.")
else:
return(rev_event_before.rev, "")

@register.filter
def no_revisions_message(iprdocrel):
draft = iprdocrel.document.document
if draft.type_id != "draft" or iprdocrel.revisions.strip() != "":
return ""
rev_at_time, exception = draft_rev_at_time(iprdocrel)
current_rev = draft.rev

first_line = "No revisions for this Internet-Draft were specified in this disclosure."
contact_line = "Contact the discloser or patent holder if there are questions about which revisions this disclosure pertains to."

if current_rev == "00":
return f"{first_line} However, there is only one revision of this Internet-Draft."

if rev_at_time:
return f"{first_line} The Internet-Draft's revision was {rev_at_time} at the time this disclosure was posted. {contact_line}"
else:
return f"{first_line} {exception} {contact_line}"

109 changes: 106 additions & 3 deletions ietf/ipr/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2009-2020, All Rights Reserved
# Copyright The IETF Trust 2009-2023, All Rights Reserved
# -*- coding: utf-8 -*-


Expand All @@ -16,13 +16,24 @@
import debug # pyflakes:ignore

from ietf.doc.models import DocAlias
from ietf.doc.factories import DocumentFactory, WgDraftFactory, WgRfcFactory
from ietf.doc.factories import (
DocumentFactory,
WgDraftFactory,
WgRfcFactory,
NewRevisionDocEventFactory
)
from ietf.group.factories import RoleFactory
from ietf.ipr.factories import HolderIprDisclosureFactory, GenericIprDisclosureFactory, IprEventFactory
from ietf.ipr.factories import (
HolderIprDisclosureFactory,
GenericIprDisclosureFactory,
IprDocRelFactory,
IprEventFactory
)
from ietf.ipr.mail import (process_response_email, get_reply_to, get_update_submitter_emails,
get_pseudo_submitter, get_holders, get_update_cc_addrs)
from ietf.ipr.models import (IprDisclosureBase,GenericIprDisclosure,HolderIprDisclosure,
ThirdPartyIprDisclosure)
from ietf.ipr.templatetags.ipr_filters import no_revisions_message
from ietf.ipr.utils import get_genitive, get_ipr_summary
from ietf.mailtrigger.utils import gather_address_lists
from ietf.message.models import Message
Expand Down Expand Up @@ -305,6 +316,38 @@ def test_new_specific(self):
r = self.client.post(url, data)
self.assertContains(r, "Your IPR disclosure has been submitted", msg_prefix="Checked patent number: %s" % patent_number)

def test_new_specific_no_revision(self):
draft = WgDraftFactory()
WgRfcFactory()
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" })

# successful post
empty_outbox()
data = {
"holder_legal_name": "Test Legal",
"holder_contact_name": "Test Holder",
"holder_contact_email": "test@holder.com",
"holder_contact_info": "555-555-0100",
"ietfer_name": "Test Participant",
"ietfer_contact_info": "555-555-0101",
"iprdocrel_set-TOTAL_FORMS": 2,
"iprdocrel_set-INITIAL_FORMS": 0,
"iprdocrel_set-0-document": draft.docalias.first().pk,
"iprdocrel_set-1-document": DocAlias.objects.filter(name__startswith="rfc").first().pk,
"patent_number": "SE12345678901",
"patent_inventor": "A. Nonymous",
"patent_title": "A method of transferring bits",
"patent_date": "2000-01-01",
"has_patent_pending": False,
"licensing": "royalty-free",
"submitter_name": "Test Holder",
"submitter_email": "test@holder.com",
}
r = self.client.post(url, data)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue(q("#id_iprdocrel_set-0-revisions").hasClass("is-invalid"))

def test_new_thirdparty(self):
"""Add a new third-party disclosure. Note: submitter does not need to be logged in.
"""
Expand Down Expand Up @@ -761,4 +804,64 @@ def test_docevent_creation(self):
removed_docevent = doc.docevent_set.filter(type='removed_related_ipr').first()
self.assertIn(ipr.title, removed_docevent.desc,
'IprDisclosure title does not appear in DocEvent desc when removed')

def test_no_revisions_message(self):
draft = WgDraftFactory(rev="02")
now = timezone.now()
for rev in range(0,3):
NewRevisionDocEventFactory(doc=draft, rev=f"{rev:02d}", time=now-datetime.timedelta(days=30*(2-rev)))

# Disclosure has non-empty revisions field on its related draft
iprdocrel = IprDocRelFactory(document=draft.docalias.first())
IprEventFactory(type_id="posted",time=now,disclosure=iprdocrel.disclosure)
self.assertEqual(
no_revisions_message(iprdocrel),
""
)

# Disclosure has more than one revision, none called out, disclosure after submissions
iprdocrel = IprDocRelFactory(document=draft.docalias.first(), revisions="")
IprEventFactory(type_id="posted",time=now,disclosure=iprdocrel.disclosure)
self.assertEqual(
no_revisions_message(iprdocrel),
"No revisions for this Internet-Draft were specified in this disclosure. The Internet-Draft's revision was 02 at the time this disclosure was posted. Contact the discloser or patent holder if there are questions about which revisions this disclosure pertains to."
)

# Disclosure has more than one revision, none called out, disclosure after 01
iprdocrel = IprDocRelFactory(document=draft.docalias.first(), revisions="")
e = IprEventFactory(type_id="posted",disclosure=iprdocrel.disclosure)
e.time = now-datetime.timedelta(days=15)
e.save()
self.assertEqual(
no_revisions_message(iprdocrel),
"No revisions for this Internet-Draft were specified in this disclosure. The Internet-Draft's revision was 01 at the time this disclosure was posted. Contact the discloser or patent holder if there are questions about which revisions this disclosure pertains to."
)

# Disclosure has more than one revision, none called out, disclosure was before the 00
iprdocrel = IprDocRelFactory(document=draft.docalias.first(), revisions="")
e = IprEventFactory(type_id="posted",disclosure=iprdocrel.disclosure)
e.time = now-datetime.timedelta(days=180)
e.save()
self.assertEqual(
no_revisions_message(iprdocrel),
"No revisions for this Internet-Draft were specified in this disclosure. The Internet-Draft's initial submission was after this disclosure was posted. Contact the discloser or patent holder if there are questions about which revisions this disclosure pertains to."
)

# disclosed draft has no NewRevisionDocEvents
draft = WgDraftFactory(rev="20")
draft.docevent_set.all().delete()
iprdocrel = IprDocRelFactory(document=draft.docalias.first(), revisions="")
IprEventFactory(type_id="posted",disclosure=iprdocrel.disclosure)
self.assertEqual(
no_revisions_message(iprdocrel),
"No revisions for this Internet-Draft were specified in this disclosure. The Internet-Draft's revision at the time this disclosure was posted could not be determined. Contact the discloser or patent holder if there are questions about which revisions this disclosure pertains to."
)

# disclosed draft has only one revision
draft = WgDraftFactory(rev="00")
iprdocrel = IprDocRelFactory(document=draft.docalias.first(), revisions="")
IprEventFactory(type_id="posted",disclosure=iprdocrel.disclosure)
self.assertEqual(
no_revisions_message(iprdocrel),
"No revisions for this Internet-Draft were specified in this disclosure. However, there is only one revision of this Internet-Draft."
)
86 changes: 67 additions & 19 deletions ietf/static/css/ietf.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,28 @@ $popover-max-width: 100%;

// Override default fonts

$font-family-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
$font-family-monospace: "Noto Sans Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
$font-family-sans-serif: "Inter",
system-ui,
-apple-system,
"Segoe UI",
Roboto,
"Helvetica Neue",
"Noto Sans",
"Liberation Sans",
Arial,
sans-serif,
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
"Noto Color Emoji";
$font-family-monospace: "Noto Sans Mono",
SFMono-Regular,
Menlo,
Monaco,
Consolas,
"Liberation Mono",
"Courier New",
monospace;

// Enable color modes
$color-mode-type: data;
Expand Down Expand Up @@ -506,29 +526,57 @@ td.position-empty {
border: none !important;
}

tr.position-moretime-row,
tr.position-notready-row,
tr.position-discuss-row,
tr.position-block-row {
background-color: tint-color($color-discuss, 85%);
}
[data-bs-theme="light"] {

tr.position-yes-row {
background-color: tint-color($color-yes, 75%);
}
tr.position-moretime-row,
tr.position-notready-row,
tr.position-discuss-row,
tr.position-block-row {
background-color: tint-color($color-discuss, 85%);
}

tr.position-noobj-row {
background-color: tint-color($color-noobj, 50%);
}
tr.position-yes-row {
background-color: tint-color($color-yes, 75%);
}

tr.position-abstain-row {
background-color: tint-color($color-abstain, 85%);
}
tr.position-noobj-row {
background-color: tint-color($color-noobj, 50%);
}

tr.position-abstain-row {
background-color: tint-color($color-abstain, 85%);
}

tr.position-recuse-row {
background-color: tint-color($color-recuse, 85%);
tr.position-recuse-row {
background-color: tint-color($color-recuse, 85%);
}
}

[data-bs-theme="dark"] {

tr.position-moretime-row,
tr.position-notready-row,
tr.position-discuss-row,
tr.position-block-row {
background-color: shade-color($color-discuss, 85%);
}

tr.position-yes-row {
background-color: shade-color($color-yes, 75%);
}

tr.position-noobj-row {
background-color: shade-color($color-noobj, 75%);
}

tr.position-abstain-row {
background-color: shade-color($color-abstain, 85%);
}

tr.position-recuse-row {
background-color: shade-color($color-recuse, 85%);
}
}

/* === Edit Meeting Schedule ====================================== */

Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
data-group-menu-data-url="{% url 'ietf.group.views.group_menu_data' %}">
{% analytical_body_top %}
<a class="visually-hidden visually-hidden-focusable" href="#content">Skip to main content</a>
<nav class="navbar navbar-expand-lg fixed-top {% if server_mode and server_mode != "production" %}bg-danger-subtle{% else %}bg-secondary{% endif %}">
<nav class="navbar navbar-expand-lg fixed-top {% if server_mode and server_mode != "production" %}bg-danger-subtle{% else %}bg-secondary-subtle{% endif %}">
<div class="container-fluid">
<a class="navbar-brand" href="/">
{% include "logo.html" with org="ietf" classes="me-2" nor=True only %}
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/doc/document_statement.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<td class="edit"></td>
<td>
<span id="statement-type">{% if doc.get_state.slug != "active" %}{{doc.get_state.name}} {% endif %}{% if doc.group %}{{doc.group.acronym|upper}} {%endif%}Statement</span>
{% if snapshot %}<span class="badge rounded-pill bg-warning">Snapshot</span>{% endif %}
{% if snapshot %}<span class="badge rounded-pill text-bg-warning">Snapshot</span>{% endif %}
{% if replaced_by %}<div>Replaced by {{ replaced_by|urlize_related_source_list:False|join:", " }}</div>{% endif %}
{% if replaces %}<div>Replaces {{ replaces|urlize_related_target_list:False|join:", " }}</div>{% endif %}
</td>
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/doc/drafts_in_iesg_process.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h1>{{ title }}</h1>
</thead>
{% for state, docs in grouped_docs %}
<tbody>
<tr class="bg-info-subtle">
<tr class="table-info">
<th scope="col" colspan="5">{{ state.name }}</th>
</tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/doc/review_assignment_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<a class="text-body-secondary"
href="{% url 'ietf.doc.views_review.review_request' review_assignment.review_request.doc.name review_assignment.review_request.pk %}">
{{ review_assignment.review_request.team.acronym|upper }} {{ review_assignment.review_request.type.name }} Review due {{ review_assignment.review_request.deadline|date:"Y-m-d" }}</a>
<span class="badge rounded-pill ms-1 bg-secondary">
<span class="badge rounded-pill text-bg-secondary ms-1">
Incomplete
</span>
{% endif %}
Expand Down
Loading

0 comments on commit 2d52398

Please sign in to comment.