Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: IAB statements #5940

Merged
merged 5 commits into from
Jul 23, 2023
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 docker/configs/settings_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# 'ietf.context_processors.sql_debug',
# ]

DOCUMENT_PATH_PATTERN = '/assets/ietf-ftp/{doc.type_id}/'
DOCUMENT_PATH_PATTERN = '/assets/ietfdata/doc/{doc.type_id}/'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move the assets around on the dev container before merging this, or deal with it later? (Earlier you said there'd be other fallout -- just confirming whether this is intentional or was forgotten)

INTERNET_DRAFT_PATH = '/assets/ietf-ftp/internet-drafts/'
RFC_PATH = '/assets/ietf-ftp/rfc/'
CHARTER_PATH = '/assets/ietf-ftp/charter/'
Expand Down
32 changes: 29 additions & 3 deletions ietf/doc/factories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2016-2020, All Rights Reserved
# Copyright The IETF Trust 2016-2023, All Rights Reserved
# -*- coding: utf-8 -*-


Expand All @@ -23,7 +23,6 @@
from ietf.utils.timezone import date_today



def draft_name_generator(type_id,group,n):
return '%s-%s-%s-%s%d'%(
type_id,
Expand Down Expand Up @@ -577,4 +576,31 @@ def states(obj, create, extracted, **kwargs):
def reset_canonical_name(obj, create, extracted, **kwargs):
if hasattr(obj, '_canonical_name'):
del obj._canonical_name
return None
return None

class StatementFactory(BaseDocumentFactory):
type_id = "statement"
title = factory.Faker("sentence")
group = factory.SubFactory("ietf.group.factories.GroupFactory", acronym="iab")

name = factory.LazyAttribute(
lambda o: "statement-%s-%s" % (xslugify(o.group.acronym), xslugify(o.title))
)
uploaded_filename = factory.LazyAttribute(lambda o: f"{o.name}-{o.rev}.md")

published_statement_event = factory.RelatedFactory(
"ietf.doc.factories.DocEventFactory",
"doc",
type="published_statement",
time=timezone.now() - datetime.timedelta(days=1),
)

@factory.post_generation
def states(obj, create, extracted, **kwargs):
if not create:
return
if extracted:
for state_type_id, state_slug in extracted:
obj.set_state(State.objects.get(type_id=state_type_id, slug=state_slug))
else:
obj.set_state(State.objects.get(type_id="statement", slug="active"))
320 changes: 320 additions & 0 deletions ietf/doc/management/commands/import_iab_statements.py

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions ietf/doc/migrations/0005_alter_docevent_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright The IETF Trust 2023, All Rights Reserved

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("doc", "0004_alter_dochistory_ad_alter_dochistory_shepherd_and_more"),
]

operations = [
migrations.AlterField(
model_name="docevent",
name="type",
field=models.CharField(
choices=[
("new_revision", "Added new revision"),
("new_submission", "Uploaded new revision"),
("changed_document", "Changed document metadata"),
("added_comment", "Added comment"),
("added_message", "Added message"),
("edited_authors", "Edited the documents author list"),
("deleted", "Deleted document"),
("changed_state", "Changed state"),
("changed_stream", "Changed document stream"),
("expired_document", "Expired document"),
("extended_expiry", "Extended expiry of document"),
("requested_resurrect", "Requested resurrect"),
("completed_resurrect", "Completed resurrect"),
("changed_consensus", "Changed consensus"),
("published_rfc", "Published RFC"),
(
"added_suggested_replaces",
"Added suggested replacement relationships",
),
(
"reviewed_suggested_replaces",
"Reviewed suggested replacement relationships",
),
("changed_action_holders", "Changed action holders for document"),
("changed_group", "Changed group"),
("changed_protocol_writeup", "Changed protocol writeup"),
("changed_charter_milestone", "Changed charter milestone"),
("initial_review", "Set initial review time"),
("changed_review_announcement", "Changed WG Review text"),
("changed_action_announcement", "Changed WG Action text"),
("started_iesg_process", "Started IESG process on document"),
("created_ballot", "Created ballot"),
("closed_ballot", "Closed ballot"),
("sent_ballot_announcement", "Sent ballot announcement"),
("changed_ballot_position", "Changed ballot position"),
("changed_ballot_approval_text", "Changed ballot approval text"),
("changed_ballot_writeup_text", "Changed ballot writeup text"),
("changed_rfc_editor_note_text", "Changed RFC Editor Note text"),
("changed_last_call_text", "Changed last call text"),
("requested_last_call", "Requested last call"),
("sent_last_call", "Sent last call"),
("scheduled_for_telechat", "Scheduled for telechat"),
("iesg_approved", "IESG approved document (no problem)"),
("iesg_disapproved", "IESG disapproved document (do not publish)"),
("approved_in_minute", "Approved in minute"),
("iana_review", "IANA review comment"),
("rfc_in_iana_registry", "RFC is in IANA registry"),
(
"rfc_editor_received_announcement",
"Announcement was received by RFC Editor",
),
("requested_publication", "Publication at RFC Editor requested"),
(
"sync_from_rfc_editor",
"Received updated information from RFC Editor",
),
("requested_review", "Requested review"),
("assigned_review_request", "Assigned review request"),
("closed_review_request", "Closed review request"),
("closed_review_assignment", "Closed review assignment"),
("downref_approved", "Downref approved"),
("posted_related_ipr", "Posted related IPR"),
("removed_related_ipr", "Removed related IPR"),
("changed_editors", "Changed BOF Request editors"),
("published_statement", "Published statement"),
],
max_length=50,
),
),
]
43 changes: 43 additions & 0 deletions ietf/doc/migrations/0006_statements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright The IETF Trust 2023, All Rights Reserved

from django.db import migrations


def forward(apps, schema_editor):
StateType = apps.get_model("doc", "StateType")
State = apps.get_model("doc", "State")

StateType.objects.create(slug="statement", label="Statement State")
State.objects.create(
slug="active",
type_id="statement",
name="Active",
order=0,
desc="The statement is active",
)
State.objects.create(
slug="replaced",
type_id="statement",
name="Replaced",
order=0,
desc="The statement has been replaced",
)


def reverse(apps, schema_editor):
StateType = apps.get_model("doc", "StateType")
State = apps.get_model("doc", "State")

State.objects.filter(type_id="statement").delete()
StateType.objects.filter(slug="statement").delete()


class Migration(migrations.Migration):
dependencies = [
("doc", "0005_alter_docevent_type"),
("name", "0004_statements"),
]

operations = [
migrations.RunPython(forward, reverse),
]
12 changes: 8 additions & 4 deletions ietf/doc/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2010-2020, All Rights Reserved
# Copyright The IETF Trust 2010-2023, All Rights Reserved
# -*- coding: utf-8 -*-


Expand Down Expand Up @@ -162,7 +162,7 @@ def get_file_path(self):
self._cached_file_path = settings.CONFLICT_REVIEW_PATH
elif self.type_id == "statchg":
self._cached_file_path = settings.STATUS_CHANGE_PATH
elif self.type_id == "bofreq":
elif self.type_id == "bofreq": # TODO: This is probably unneeded, as is the separate path setting
self._cached_file_path = settings.BOFREQ_PATH
else:
self._cached_file_path = settings.DOCUMENT_PATH_PATTERN.format(doc=self)
Expand All @@ -186,7 +186,7 @@ def get_base_name(self):
elif self.type_id == 'review':
# TODO: This will be wrong if a review is updated on the same day it was created (or updated more than once on the same day)
self._cached_base_name = "%s.txt" % self.name
elif self.type_id == 'bofreq':
elif self.type_id in ['bofreq', 'statement']:
self._cached_base_name = "%s-%s.md" % (self.name, self.rev)
else:
if self.rev:
Expand Down Expand Up @@ -1290,7 +1290,11 @@ class DocReminder(models.Model):
("removed_related_ipr", "Removed related IPR"),

# Bofreq Editor events
("changed_editors", "Changed BOF Request editors")
("changed_editors", "Changed BOF Request editors"),

# Statement events
("published_statement", "Published statement"),

]

class DocEvent(models.Model):
Expand Down
Loading
Loading