Skip to content

Commit 0051aa9

Browse files
fix: search correct doc type/states, switch rfc correctly in html_body, remove dead code. (ietf-tools#6640)
* fix: search correct doc type/states, switch rfc correctly in html_body, remove dead code * chore: Add unreachable() marker --------- Co-authored-by: Jennifer Richards <jennifer@staff.ietf.org>
1 parent 9fedce0 commit 0051aa9

3 files changed

Lines changed: 4 additions & 12 deletions

File tree

ietf/doc/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def text_or_error(self):
539539
return self.text() or "Error; cannot read '%s'"%self.get_base_name()
540540

541541
def html_body(self, classes=""):
542-
if self.get_state_slug() == "rfc":
542+
if self.type_id == "rfc":
543543
try:
544544
html = Path(
545545
os.path.join(settings.RFC_PATH, self.name + ".html")

ietf/doc/utils.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -352,16 +352,6 @@ def augment_events_with_revision(doc, events):
352352
qs = NewRevisionDocEvent.objects.filter(doc=doc)
353353
event_revisions = list(qs.order_by('time', 'id').values('id', 'rev', 'time'))
354354

355-
if doc.type_id == "draft" and doc.get_state_slug() == "rfc":
356-
# add fake "RFC" revision
357-
if isinstance(events, QuerySetAny):
358-
e = events.filter(type="published_rfc").order_by('time').last()
359-
else:
360-
e = doc.latest_event(type="published_rfc")
361-
if e:
362-
event_revisions.append(dict(id=e.id, time=e.time, rev="RFC"))
363-
event_revisions.sort(key=lambda x: (x["time"], x["id"]))
364-
365355
for e in sorted(events, key=lambda e: (e.time, e.id), reverse=True):
366356
while event_revisions and (e.time, e.id) < (event_revisions[-1]["time"], event_revisions[-1]["id"]):
367357
event_revisions.pop()

ietf/doc/utils_search.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from ietf.doc.utils import augment_docs_and_user_with_user_info
1515
from ietf.meeting.models import SessionPresentation, Meeting, Session
1616
from ietf.review.utils import review_assignments_to_list_for_docs
17+
from ietf.utils import log
1718
from ietf.utils.timezone import date_today
1819

1920

@@ -102,6 +103,7 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False):
102103
if d.type_id == "draft":
103104
state_slug = d.get_state_slug()
104105
if state_slug == "rfc":
106+
log.unreachable("2023-11-15")
105107
d.search_heading = "RFC"
106108
d.expirable = False
107109
elif state_slug in ("ietf-rm", "auth-rm"):
@@ -117,7 +119,7 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False):
117119
d.search_heading = "%s" % (d.type,)
118120
d.expirable = False
119121

120-
if d.get_state_slug() != "rfc":
122+
if d.type_id == "draft" and d.get_state_slug() != "rfc":
121123
d.milestones = [ m for (t, s, v, m) in sorted(((m.time, m.state.slug, m.desc, m) for m in d.groupmilestone_set.all() if m.state_id == "active")) ]
122124
d.review_assignments = review_assignments_to_list_for_docs([d]).get(d.name, [])
123125

0 commit comments

Comments
 (0)