Skip to content

Commit

Permalink
ci: merge main to release(#7613)
Browse files Browse the repository at this point in the history
ci: merge main to release
  • Loading branch information
rjsparks authored Jun 28, 2024
2 parents b72af97 + 8916ae0 commit 2033d60
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 94 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ jobs:
with:
workflow: deploy.yml
repo: ietf-tools/infra-k8s
ref: main
token: ${{ secrets.GH_INFRA_K8S_TOKEN }}
inputs: '{ "environment":"${{ secrets.GHA_K8S_CLUSTER }}", "app":"datatracker", "appVersion":"${{ env.PKG_VERSION }}", "remoteRef":"${{ github.sha }}" }'
wait-for-completion: true
Expand All @@ -455,6 +456,7 @@ jobs:
with:
workflow: deploy.yml
repo: ietf-tools/infra-k8s
ref: main
token: ${{ secrets.GH_INFRA_K8S_TOKEN }}
inputs: '{ "environment":"${{ secrets.GHA_K8S_CLUSTER }}", "app":"datatracker", "appVersion":"${{ env.PKG_VERSION }}", "remoteRef":"${{ github.sha }}" }'
wait-for-completion: true
Expand Down
30 changes: 15 additions & 15 deletions dev/deploy-to-container/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev/deploy-to-container/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"nanoid": "5.0.7",
"nanoid-dictionary": "5.0.0-beta.1",
"slugify": "1.6.6",
"tar": "^7.1.0",
"tar": "^7.4.0",
"yargs": "^17.7.2"
},
"engines": {
Expand Down
30 changes: 15 additions & 15 deletions dev/diff/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev/diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"lodash-es": "^4.17.21",
"luxon": "^3.4.4",
"pretty-bytes": "^6.1.1",
"tar": "^7.1.0",
"tar": "^7.4.0",
"yargs": "^17.7.2"
},
"engines": {
Expand Down
122 changes: 75 additions & 47 deletions ietf/doc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from django.conf import settings
from django.contrib import messages
from django.db.models import OuterRef
from django.forms import ValidationError
from django.http import Http404
from django.template.loader import render_to_string
Expand All @@ -39,7 +40,7 @@
from ietf.name.models import DocReminderTypeName, DocRelationshipName
from ietf.group.models import Role, Group, GroupFeatures
from ietf.ietfauth.utils import has_role, is_authorized_in_doc_stream, is_individual_draft_author, is_bofreq_editor
from ietf.person.models import Person
from ietf.person.models import Email, Person
from ietf.review.models import ReviewWish
from ietf.utils import draft, log
from ietf.utils.mail import parseaddr, send_mail
Expand Down Expand Up @@ -1301,9 +1302,13 @@ def get_draft_shepherd_email(self, doc):
def get_draft_authors_emails(self, doc):
"""Get list of authors for the given draft."""
author_emails = set()
for author in doc.documentauthor_set.all():
if author.email and author.email.email_address():
author_emails.add(author.email.email_address())
for email in Email.objects.filter(documentauthor__document=doc):
if email.active:
author_emails.add(email.address)
elif email.person:
person_email = email.person.email_address()
if person_email:
author_emails.add(person_email)
return author_emails

def get_draft_notify_emails(self, doc):
Expand Down Expand Up @@ -1336,59 +1341,82 @@ def get_draft_notify_emails(self, doc):
notify_emails.add(email)
return notify_emails

def _yield_aliases_for_draft(self, doc)-> Iterator[tuple[str, list[str]]]:
alias = doc.name
all = set()

# no suffix and .authors are the same list
emails = self.get_draft_authors_emails(doc)
all.update(emails)
if emails:
yield alias, list(emails)
yield alias + ".authors", list(emails)

# .chairs = group chairs
emails = self.get_draft_chair_emails(doc)
if emails:
all.update(emails)
yield alias + ".chairs", list(emails)

# .ad = sponsoring AD / WG AD (WG document)
emails = self.get_draft_ad_emails(doc)
if emails:
all.update(emails)
yield alias + ".ad", list(emails)

# .notify = notify email list from the Document
emails = self.get_draft_notify_emails(doc)
if emails:
all.update(emails)
yield alias + ".notify", list(emails)

# .shepherd = shepherd email from the Document
emails = self.get_draft_shepherd_email(doc)
if emails:
all.update(emails)
yield alias + ".shepherd", list(emails)

# .all = everything from above
if all:
yield alias + ".all", list(all)

def __iter__(self) -> Iterator[tuple[str, list[str]]]:
# Internet-Drafts with active status or expired within self.days
show_since = timezone.now() - datetime.timedelta(days=self.days)
drafts = self.draft_queryset
active_drafts = drafts.filter(states__slug='active')
inactive_recent_drafts = drafts.exclude(states__slug='active').filter(expires__gte=show_since)
interesting_drafts = active_drafts | inactive_recent_drafts

for this_draft in interesting_drafts.distinct().iterator():
# Look up the draft-active state properly. Doing this with
# states__type_id, states__slug directly in the `filter()`
# works, but it does not work as expected in `exclude()`.
active_state = State.objects.get(type_id="draft", slug="active")
active_drafts = drafts.filter(states=active_state)
for this_draft in active_drafts:
for alias, addresses in self._yield_aliases_for_draft(this_draft):
yield alias, addresses

# Annotate with the draft state slug so we can check for drafts that
# have become RFCs
inactive_recent_drafts = (
drafts.exclude(states=active_state)
.filter(expires__gte=show_since)
.annotate(
# Why _default_manager instead of objects? See:
# https://docs.djangoproject.com/en/4.2/topics/db/managers/#django.db.models.Model._default_manager
draft_state_slug=Document.states.through._default_manager.filter(
document__pk=OuterRef("pk"),
state__type_id="draft"
).values("state__slug"),
)
)
for this_draft in inactive_recent_drafts:
# Omit drafts that became RFCs, unless they were published in the last DEFAULT_YEARS
if this_draft.get_state_slug() == "rfc":
if this_draft.draft_state_slug == "rfc":
rfc = this_draft.became_rfc()
log.assertion("rfc is not None")
if rfc.latest_event(type='published_rfc').time < show_since:
continue

alias = this_draft.name
all = set()

# no suffix and .authors are the same list
emails = self.get_draft_authors_emails(this_draft)
all.update(emails)
if emails:
yield alias, list(emails)
yield alias + ".authors", list(emails)

# .chairs = group chairs
emails = self.get_draft_chair_emails(this_draft)
if emails:
all.update(emails)
yield alias + ".chairs", list(emails)

# .ad = sponsoring AD / WG AD (WG document)
emails = self.get_draft_ad_emails(this_draft)
if emails:
all.update(emails)
yield alias + ".ad", list(emails)

# .notify = notify email list from the Document
emails = self.get_draft_notify_emails(this_draft)
if emails:
all.update(emails)
yield alias + ".notify", list(emails)

# .shepherd = shepherd email from the Document
emails = self.get_draft_shepherd_email(this_draft)
if emails:
all.update(emails)
yield alias + ".shepherd", list(emails)

# .all = everything from above
if all:
yield alias + ".all", list(all)
for alias, addresses in self._yield_aliases_for_draft(this_draft):
yield alias, addresses


def get_doc_email_aliases(name: Optional[str] = None):
Expand Down
Loading

0 comments on commit 2033d60

Please sign in to comment.