Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ietf/doc/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def subtitle(self, obj):
return "History of change entries for %s." % obj.display_name()

def items(self, obj):
events = obj.docevent_set.all().order_by("-time","-id")
events = obj.docevent_set.all().order_by("-time","-id").select_related("by", "newrevisiondocevent", "submissiondocevent")
augment_events_with_revision(obj, events)
return events

Expand Down
12 changes: 10 additions & 2 deletions ietf/doc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from django.conf import settings
from django.contrib import messages
from django.db.models import QuerySet
from django.forms import ValidationError
from django.http import Http404
from django.template.loader import render_to_string
Expand Down Expand Up @@ -344,11 +345,18 @@ def augment_events_with_revision(doc, events):
"""Take a set of events for doc and add a .rev attribute with the
revision they refer to by checking NewRevisionDocEvents."""

event_revisions = list(NewRevisionDocEvent.objects.filter(doc=doc).order_by('time', 'id').values('id', 'rev', 'time'))
if isinstance(events, QuerySet):
qs = events.filter(newrevisiondocevent__isnull=False)
else:
qs = NewRevisionDocEvent.objects.filter(doc=doc)
event_revisions = list(qs.order_by('time', 'id').values('id', 'rev', 'time'))

if doc.type_id == "draft" and doc.get_state_slug() == "rfc":
# add fake "RFC" revision
e = doc.latest_event(type="published_rfc")
if isinstance(events, QuerySet):
e = events.filter(type="published_rfc").order_by('time').last()
else:
e = doc.latest_event(type="published_rfc")
if e:
event_revisions.append(dict(id=e.id, time=e.time, rev="RFC"))
event_revisions.sort(key=lambda x: (x["time"], x["id"]))
Expand Down