fix: search correct doc type/states, switch rfc correctly in html_body, remove dead code. (#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>
This commit is contained in:
parent
9fedce005f
commit
0051aa9844
ietf/doc
|
@ -539,7 +539,7 @@ class DocumentInfo(models.Model):
|
|||
return self.text() or "Error; cannot read '%s'"%self.get_base_name()
|
||||
|
||||
def html_body(self, classes=""):
|
||||
if self.get_state_slug() == "rfc":
|
||||
if self.type_id == "rfc":
|
||||
try:
|
||||
html = Path(
|
||||
os.path.join(settings.RFC_PATH, self.name + ".html")
|
||||
|
|
|
@ -352,16 +352,6 @@ def augment_events_with_revision(doc, events):
|
|||
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
|
||||
if isinstance(events, QuerySetAny):
|
||||
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"]))
|
||||
|
||||
for e in sorted(events, key=lambda e: (e.time, e.id), reverse=True):
|
||||
while event_revisions and (e.time, e.id) < (event_revisions[-1]["time"], event_revisions[-1]["id"]):
|
||||
event_revisions.pop()
|
||||
|
|
|
@ -14,6 +14,7 @@ from ietf.doc.expire import expirable_drafts
|
|||
from ietf.doc.utils import augment_docs_and_user_with_user_info
|
||||
from ietf.meeting.models import SessionPresentation, Meeting, Session
|
||||
from ietf.review.utils import review_assignments_to_list_for_docs
|
||||
from ietf.utils import log
|
||||
from ietf.utils.timezone import date_today
|
||||
|
||||
|
||||
|
@ -102,6 +103,7 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False):
|
|||
if d.type_id == "draft":
|
||||
state_slug = d.get_state_slug()
|
||||
if state_slug == "rfc":
|
||||
log.unreachable("2023-11-15")
|
||||
d.search_heading = "RFC"
|
||||
d.expirable = False
|
||||
elif state_slug in ("ietf-rm", "auth-rm"):
|
||||
|
@ -117,7 +119,7 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False):
|
|||
d.search_heading = "%s" % (d.type,)
|
||||
d.expirable = False
|
||||
|
||||
if d.get_state_slug() != "rfc":
|
||||
if d.type_id == "draft" and d.get_state_slug() != "rfc":
|
||||
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")) ]
|
||||
d.review_assignments = review_assignments_to_list_for_docs([d]).get(d.name, [])
|
||||
|
||||
|
|
Loading…
Reference in a new issue