fix: cleaner search_result_row diff links for recent drafts replacing other drafts

This commit is contained in:
Robert Sparks 2023-09-25 15:39:48 -05:00
parent 4d440853c7
commit 9e4166393d
No known key found for this signature in database
GPG key ID: 6E2A6A5775F91318
2 changed files with 4 additions and 7 deletions

View file

@ -512,12 +512,7 @@ class DocumentInfo(models.Model):
return list(set([x.target for x in self.all_relations_that_doc(relationship)]))
def replaces(self):
return set([ d for r in self.related_that_doc("replaces") for d in r.docs.all() ])
def replaces_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()
return self.related_that_doc("replaces")
def replaced_by(self):
return set([ r.document for r in self.related_that("replaces") ])

View file

@ -110,7 +110,9 @@
{% if doc.rev != "00" %}
<a href="{{ rfcdiff_base_url }}?url2={{ doc.name }}-{{ doc.rev }}">
{% elif doc.replaces %}
<a href="{{ rfcdiff_base_url }}?url1={{ doc.replaces_name }}&amp;url2={{ doc.name }}-{{ doc.rev }}">
{% with first_replaces=doc.replaces|first %}
<a href="{{ rfcdiff_base_url }}?url1={{ first_replaces.name }}&amp;url2={{ doc.name }}-{{ doc.rev }}">
{% endwith %}
{% endif %}
{% endif %}
{% if doc.type_id == "rfc" %}