Skip to content

Commit cfdbae1

Browse files
committed
Fixed bad calls to rfcdiff for -00 drafts and replaced drafts. Fixes issue ietf-tools#2697. Commit ready for merge.
- Legacy-Id: 16095
1 parent 7224e06 commit cfdbae1

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

ietf/doc/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,11 @@ def all_related_that_doc(self, relationship, related=None):
465465
def replaces(self):
466466
return set([ r.document for r in self.related_that_doc("replaces")])
467467

468+
def replaces_canonical_name(self):
469+
s = set([ r.document for r in self.related_that_doc("replaces")])
470+
first = list(s)[0] if s else None
471+
return None if first is None else first.filename_with_rev()
472+
468473
def replaced_by(self):
469474
return set([ r.document for r in self.related_that("replaces") ])
470475

ietf/templates/doc/search/search_result_row.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,15 @@
5959

6060
<td>
6161
<span class="text-nowrap">
62-
{% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %}<a href="{{ rfcdiff_base_url }}?url2={{ doc.name }}-{{ doc.rev }}">{% endif %}
63-
{% if doc.get_state_slug == "rfc" %}{{ doc.latest_revision_date|date:"Y-m" }}{% else %}{{ doc.latest_revision_date|date:"Y-m-d" }}{% endif %}
64-
{% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %}</a>{% endif %}
62+
63+
{% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %}
64+
{% if doc.replaces %}<a href="{{ rfcdiff_base_url }}?url1={{ doc.replaces_canonical_name}}&url2={{ doc.name }}-{{ doc.rev }}">
65+
{% elif doc.rev != "00" %}<a href="{{ rfcdiff_base_url }}?url2={{ doc.name }}-{{ doc.rev }}">{% endif %}
66+
{% endif %}
67+
{% if doc.get_state_slug == "rfc" %}{{ doc.latest_revision_date|date:"Y-m" }}{% else %}{{ doc.latest_revision_date|date:"Y-m-d" }}{% endif %}
68+
{% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %}
69+
{% if doc.rev != "00" or doc.replaces %}</a>{% endif %}
70+
{% endif %}
6571
</span>
6672

6773
{% for check in doc.submission.latest_checks %}

0 commit comments

Comments
 (0)