Skip to content

Commit

Permalink
Fixed bad calls to rfcdiff for -00 drafts and replaced drafts. Fixes …
Browse files Browse the repository at this point in the history
…issue #2697.  Commit ready for merge.

 - Legacy-Id: 16095
  • Loading branch information
Spectre17 committed Mar 23, 2019
1 parent 7224e06 commit cfdbae1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ietf/doc/models.py
Expand Up @@ -465,6 +465,11 @@ def all_related_that_doc(self, relationship, related=None):
def replaces(self):
return set([ r.document for r in self.related_that_doc("replaces")])

def replaces_canonical_name(self):
s = set([ r.document for r in self.related_that_doc("replaces")])
first = list(s)[0] if s else None
return None if first is None else first.filename_with_rev()

def replaced_by(self):
return set([ r.document for r in self.related_that("replaces") ])

Expand Down
12 changes: 9 additions & 3 deletions ietf/templates/doc/search/search_result_row.html
Expand Up @@ -59,9 +59,15 @@

<td>
<span class="text-nowrap">
{% 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 %}
{% if doc.get_state_slug == "rfc" %}{{ doc.latest_revision_date|date:"Y-m" }}{% else %}{{ doc.latest_revision_date|date:"Y-m-d" }}{% endif %}
{% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %}</a>{% endif %}

{% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %}
{% if doc.replaces %}<a href="{{ rfcdiff_base_url }}?url1={{ doc.replaces_canonical_name}}&url2={{ doc.name }}-{{ doc.rev }}">
{% elif doc.rev != "00" %}<a href="{{ rfcdiff_base_url }}?url2={{ doc.name }}-{{ doc.rev }}">{% endif %}
{% endif %}
{% if doc.get_state_slug == "rfc" %}{{ doc.latest_revision_date|date:"Y-m" }}{% else %}{{ doc.latest_revision_date|date:"Y-m-d" }}{% endif %}
{% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %}
{% if doc.rev != "00" or doc.replaces %}</a>{% endif %}
{% endif %}
</span>

{% for check in doc.submission.latest_checks %}
Expand Down

0 comments on commit cfdbae1

Please sign in to comment.