Merge pull request #6374 from rjsparks/more_docalias_removal

fix: cleaner search_result_row diff links for recent drafts replacing other drafts
This commit is contained in:
Jennifer Richards 2023-09-26 22:24:17 -03:00 committed by GitHub
commit 82c70a2d5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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" %}