diff --git a/ietf/doc/expire.py b/ietf/doc/expire.py index 5e1add9cd..abd377ee6 100644 --- a/ietf/doc/expire.py +++ b/ietf/doc/expire.py @@ -26,12 +26,17 @@ def expirable_draft(draft): if draft.type_id != 'draft': return False log.assertion('draft.get_state_slug("draft-iesg")') - # return (draft.expires and draft.get_state_slug() == "active" - # and draft.get_state_slug("draft-iesg") in ("idexists", "watching", "dead") - # and draft.get_state_slug("draft-stream-%s" % draft.stream_id) not in ("rfc-edit", "pub") - # and not draft.tags.filter(slug="rfc-rev")) return bool(expirable_drafts(Document.objects.filter(pk=draft.pk))) +nonexpirable_states = [] +# all IESG states except I-D Exists, AD Watching, and Dead block expiry +nonexpirable_states += list(State.objects.filter(used=True, type="draft-iesg").exclude(slug__in=("idexists","watching", "dead"))) +# sent to RFC Editor and RFC Published block expiry (the latter +# shouldn't be possible for an active draft, though) +nonexpirable_states += list(State.objects.filter(used=True, type__in=("draft-stream-iab", "draft-stream-irtf", "draft-stream-ise"), slug__in=("rfc-edit", "pub"))) +# other IRTF states that block expiration +nonexpirable_states += list(State.objects.filter(used=True, type_id="draft-stream-irtf", slug__in=("irsgpoll", "iesg-rev",))) + def expirable_drafts(queryset=None): """Return a queryset with expirable drafts.""" # the general rule is that each active draft is expirable, unless @@ -39,18 +44,20 @@ def expirable_drafts(queryset=None): if not queryset: queryset = Document.objects.all() - d = queryset.filter(states__type="draft", states__slug="active").exclude(expires=None) + if queryset.count() > 1: + print("***", queryset.count()) - nonexpirable_states = [] - # all IESG states except I-D Exists, AD Watching, and Dead block expiry - nonexpirable_states += list(State.objects.filter(used=True, type="draft-iesg").exclude(slug__in=("idexists","watching", "dead"))) - # sent to RFC Editor and RFC Published block expiry (the latter - # shouldn't be possible for an active draft, though) - nonexpirable_states += list(State.objects.filter(used=True, type__in=("draft-stream-iab", "draft-stream-irtf", "draft-stream-ise"), slug__in=("rfc-edit", "pub"))) - # other IRTF states that block expiration - nonexpirable_states += list(State.objects.filter(used=True, type_id="draft-stream-irtf", slug__in=("irsgpoll", "iesg-rev",))) + d = queryset.filter(states__type="draft", states__slug="active") + if not d.exists(): + return d + + d = d.exclude(expires=None) + if not d.exists(): + return d d = d.exclude(states__in=nonexpirable_states) + if not d.exists(): + return d # under review by the RFC Editor blocks expiry d = d.exclude(tags="rfc-rev") diff --git a/ietf/doc/utils_search.py b/ietf/doc/utils_search.py index 14227f4a8..1a6741554 100644 --- a/ietf/doc/utils_search.py +++ b/ietf/doc/utils_search.py @@ -94,16 +94,22 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False): d.latest_revision_date = d.time if d.type_id == "draft": - if d.get_state_slug() == "rfc": + state_slug = d.get_state_slug() + if state_slug == "rfc": d.search_heading = "RFC" - elif d.get_state_slug() in ("ietf-rm", "auth-rm"): + d.expirable = False + elif state_slug in ("ietf-rm", "auth-rm"): d.search_heading = "Withdrawn Internet-Draft" + d.expirable = False else: d.search_heading = "%s Internet-Draft" % d.get_state() + if state_slug == "active": + d.expirable = expirable_draft(d) + else: + d.expirable = False else: - d.search_heading = "%s" % (d.type,); - - d.expirable = expirable_draft(d) + d.search_heading = "%s" % (d.type,) + d.expirable = expirable_draft(d) if 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")) ] @@ -137,13 +143,16 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False): l.append(rel_rfc_aliases[rel.source_id].upper()) l.sort() - def prepare_document_table(request, docs, query=None, max_results=200): """Take a queryset of documents and a QueryDict with sorting info and return list of documents with attributes filled in for displaying a full table of information about the documents, plus dict with information about the columns.""" + if docs.count() > max_results: + docs = docs[:max_results] + docs = list(docs) + if not isinstance(docs, list): # evaluate and fill in attribute results immediately to decrease # the number of queries @@ -151,10 +160,6 @@ def prepare_document_table(request, docs, query=None, max_results=200): docs = docs.prefetch_related("states__type", "tags", "groupmilestone_set__group", "reviewrequest_set__team", "submission_set__checks", "ad__email_set", "docalias__iprdocrel_set") - if docs.count() > max_results: - docs = docs[:max_results] - docs = list(docs) - fill_in_document_table_attributes(docs) augment_docs_with_tracking_info(docs, request.user) diff --git a/ietf/meeting/models.py b/ietf/meeting/models.py index 464b2ae15..6048ac105 100644 --- a/ietf/meeting/models.py +++ b/ietf/meeting/models.py @@ -1056,7 +1056,7 @@ class Session(models.Model): return 'sess%s' % (string.ascii_lowercase[index]) def constraints(self): - return Constraint.objects.filter(source=self.group, meeting=self.meeting).order_by('name__name') + return Constraint.objects.filter(source=self.group, meeting=self.meeting).order_by('name__name').prefetch_related("source","target","person") def reverse_constraints(self): return Constraint.objects.filter(target=self.group, meeting=self.meeting).order_by('name__name') diff --git a/ietf/meeting/views.py b/ietf/meeting/views.py index 8f6de41a7..025da60fc 100644 --- a/ietf/meeting/views.py +++ b/ietf/meeting/views.py @@ -1043,9 +1043,9 @@ def json_agenda(request, num=None ): def meeting_requests(request, num=None): meeting = get_meeting(num) - sessions = Session.objects.filter(meeting__number=meeting.number, type__slug='session', group__parent__isnull = False).exclude(requested_by=0).order_by("group__parent__acronym","status__slug","group__acronym") + sessions = Session.objects.filter(meeting__number=meeting.number, type__slug='session', group__parent__isnull = False).exclude(requested_by=0).order_by("group__parent__acronym","status__slug","group__acronym").prefetch_related("group","group__ad_role__person","requested_by") - groups_not_meeting = Group.objects.filter(state='Active',type__in=['wg','rg','ag','bof']).exclude(acronym__in = [session.group.acronym for session in sessions]).order_by("parent__acronym","acronym") + groups_not_meeting = Group.objects.filter(state='Active',type__in=['wg','rg','ag','bof']).exclude(acronym__in = [session.group.acronym for session in sessions]).order_by("parent__acronym","acronym").prefetch_related("parent") return render(request, "meeting/requests.html", {"meeting": meeting, "sessions":sessions, diff --git a/ietf/templates/base/menu.html b/ietf/templates/base/menu.html index 2fcfc3ccc..50392701c 100644 --- a/ietf/templates/base/menu.html +++ b/ietf/templates/base/menu.html @@ -49,45 +49,45 @@ {% if user and user.is_authenticated %}
{{ g.acronym }} (No session requested)
- {% endif %} - {% endfor %} + {% if user and user.is_authenticated %} + {% with user|matman_groups as user_groups %} + {% if user_groups %} + {% for g in user_groups %} + {% if g|has_sessions:meeting_num %} + + {% else %} +{{ g.acronym }} (No session requested)
+ {% endif %} + {% endfor %} + {% else %} +You cannot manage the meeting materials for any groups.
+ {% endif %} + {% endwith %} {% else %}You cannot manage the meeting materials for any groups.
{% endif %} diff --git a/ietf/templates/meeting/requests.html b/ietf/templates/meeting/requests.html index 380a6244a..a37ce500e 100644 --- a/ietf/templates/meeting/requests.html +++ b/ietf/templates/meeting/requests.html @@ -90,19 +90,27 @@ {% ifchanged grouped_constraint.grouper %}