Merged in [15120] from rjsparks@nostrum.com:

Missed adding the migrations. Related to #1963.

Merged in [15119] from rjsparks@nostrum.com:
Change stream state to replaced when an ISE, IAB, or IRTF document
is replaced. Fixes #1963.
 - Legacy-Id: 15122
Note: SVN reference [15119] has been migrated to Git commit 1295f1f1d2

Note: SVN reference [15120] has been migrated to Git commit 1c16926ee6
This commit is contained in:
Henrik Levkowetz 2018-05-04 12:17:33 +00:00
commit faee5f66da
5 changed files with 223 additions and 10 deletions

View file

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-03 11:50
from __future__ import unicode_literals
from django.db import migrations
def forward(apps, schema_editor):
State = apps.get_model('doc','State')
for type_id in ('draft-stream-iab','draft-stream-ise','draft-stream-irtf'):
State.objects.create(type_id=type_id,
slug='repl',
name='Replaced',
desc='Replaced',
)
def reverse(apps, schema_editor):
State = apps.get_model('doc','State')
State.objects.filter(type_id__in=('draft-stream-iab','draft-stream-ise','draft-stream-irtf'), slug='repl').delete()
class Migration(migrations.Migration):
dependencies = [
('doc', '0003_auto_20180401_1231'),
]
operations = [
migrations.RunPython(forward,reverse)
]

View file

@ -0,0 +1,111 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-03 12:16
from __future__ import unicode_literals
from django.db import migrations
def forward(apps, schema_editor):
Document = apps.get_model('doc','Document')
State = apps.get_model('doc','State')
iab_active = State.objects.get(type_id='draft-stream-iab',slug='active')
iab_replaced = State.objects.get(type_id='draft-stream-iab',slug='repl')
irtf_active = State.objects.get(type_id='draft-stream-irtf',slug='active')
irtf_candidate = State.objects.get(type_id='draft-stream-irtf',slug='candidat')
irtf_replaced = State.objects.get(type_id='draft-stream-irtf',slug='repl')
irtf_dead = State.objects.get(type_id='draft-stream-irtf',slug='dead')
doc = Document.objects.get(name='draft-flanagan-rfc-preservation')
doc.states.remove(iab_active)
doc.states.add(iab_replaced)
doc = Document.objects.get(name='draft-trammell-semi-report')
doc.states.remove(iab_active)
doc.states.add(iab_replaced)
doc = Document.objects.get(name='draft-nir-cfrg-chacha20-poly1305')
doc.states.remove(irtf_candidate)
doc.states.add(irtf_replaced)
doc = Document.objects.get(name='draft-ladd-spake2')
doc.states.remove(irtf_candidate)
doc.states.add(irtf_replaced)
doc = Document.objects.get(name='draft-lee-nfvrg-resource-management-service-chain')
doc.states.remove(irtf_candidate)
doc.states.add(irtf_replaced)
doc = Document.objects.get(name='draft-keranen-t2trg-rest-iot')
doc.states.remove(irtf_candidate)
doc.states.add(irtf_replaced)
doc = Document.objects.get(name='draft-josefsson-argon2')
doc.states.remove(irtf_active)
doc.states.add(irtf_replaced)
doc = Document.objects.get(name='draft-tenoever-hrpc-research')
doc.states.remove(irtf_active)
doc.states.add(irtf_replaced)
doc = Document.objects.get(name='draft-kutscher-icnrg-challenges')
doc.states.remove(irtf_dead)
doc.states.add(irtf_replaced)
def reverse(apps, schema_editor):
Document = apps.get_model('doc','Document')
State = apps.get_model('doc','State')
iab_active = State.objects.get(type_id='draft-stream-iab',slug='active')
iab_replaced = State.objects.get(type_id='draft-stream-iab',slug='repl')
irtf_active = State.objects.get(type_id='draft-stream-irtf',slug='active')
irtf_candidate = State.objects.get(type_id='draft-stream-irtf',slug='candidat')
irtf_replaced = State.objects.get(type_id='draft-stream-irtf',slug='repl')
irtf_dead = State.objects.get(type_id='draft-stream-irtf',slug='dead')
doc = Document.objects.get(name='draft-flanagan-rfc-preservation')
doc.states.add(iab_active)
doc.states.remove(iab_replaced)
doc = Document.objects.get(name='draft-trammell-semi-report')
doc.states.add(iab_active)
doc.states.remove(iab_replaced)
doc = Document.objects.get(name='draft-nir-cfrg-chacha20-poly1305')
doc.states.add(irtf_candidate)
doc.states.remove(irtf_replaced)
doc = Document.objects.get(name='draft-ladd-spake2')
doc.states.add(irtf_candidate)
doc.states.remove(irtf_replaced)
doc = Document.objects.get(name='draft-lee-nfvrg-resource-management-service-chain')
doc.states.add(irtf_candidate)
doc.states.remove(irtf_replaced)
doc = Document.objects.get(name='draft-keranen-t2trg-rest-iot')
doc.states.add(irtf_candidate)
doc.states.remove(irtf_replaced)
doc = Document.objects.get(name='draft-josefsson-argon2')
doc.states.add(irtf_active)
doc.states.remove(irtf_replaced)
doc = Document.objects.get(name='draft-tenoever-hrpc-research')
doc.states.add(irtf_active)
doc.states.remove(irtf_replaced)
doc = Document.objects.get(name='draft-kutscher-icnrg-challenges')
doc.states.add(irtf_dead)
doc.states.remove(irtf_replaced)
class Migration(migrations.Migration):
dependencies = [
('doc', '0004_add_draft_stream_replaced_states'),
]
operations = [
migrations.RunPython(forward, reverse)
]

View file

@ -1566,3 +1566,21 @@ class ChangeReplacesTests(TestCase):
self.assertTrue(not self.replacea.related_that_doc("possibly-replaces"))
self.assertEqual(len(self.replacea.related_that_doc("replaces")), 1)
self.assertEquals(Document.objects.get(pk=self.basea.pk).get_state().slug, 'repl')
class MoreReplacesTests(TestCase):
def test_stream_state_changes_when_replaced(self):
self.client.login(username='secretary',password='secretary+password')
for stream in ('iab','irtf','ise'):
old_doc = DocumentFactory(stream_id=stream)
old_doc.set_state(State.objects.get(type_id='draft-stream-%s'%stream, slug='ise-rev' if stream=='ise' else 'active'))
new_doc = DocumentFactory(stream_id=stream)
url = urlreverse('ietf.doc.views_draft.replaces', kwargs=dict(name=new_doc.name))
r = self.client.post(url, dict(replaces=old_doc.name))
self.assertEqual(r.status_code,302)
old_doc = Document.objects.get(name=old_doc.name)
self.assertEqual(old_doc.get_state_slug('draft'),'repl')
self.assertEqual(old_doc.get_state_slug('draft-stream-%s'%stream),'repl')

View file

@ -593,6 +593,11 @@ def set_replaces_for_document(request, doc, new_replaces, by, email_subject, com
RelatedDocument.objects.create(source=doc, target=d, relationship=relationship)
d.document.set_state(State.objects.get(type='draft', slug='repl'))
if d.document.stream_id in ('irtf','ise','iab'):
repl_state = State.objects.get(type_id='draft-stream-%s'%d.document.stream_id, slug='repl')
d.document.set_state(repl_state)
events.append(StateDocEvent.objects.create(doc=d.document, rev=d.document.rev, by=by, type='changed_state', desc="Set stream state to Replaced",state_type=repl_state.type, state=repl_state))
# make sure there are no lingering suggestions duplicating new replacements
RelatedDocument.objects.filter(source=doc, target__in=new_replaces, relationship="possibly-replaces").delete()

View file

@ -1277,7 +1277,7 @@
},
{
"fields": {
"desc": "The IESG and IAB are reviewing the early draft of the charter; this is the initial IESG and IAB review. The usual next state is External review if the idea is adopted, or Informal IESG review if the IESG decides the idea needs more work, or Not currently under review is the idea is abandoned",
"desc": "The IESG and IAB are reviewing the early draft of the charter; this is the initial IESG and IAB review. The usual next state is External review if the idea is adopted, or Informal IESG review if the IESG decides the idea needs more work, or Not currently under review if the idea is abandoned",
"name": "Internal review",
"next_states": [],
"order": 0,
@ -1290,7 +1290,7 @@
},
{
"fields": {
"desc": "The IETF community and possibly other standards development organizations (SDOs) are reviewing the proposed charter. The usual next state is IESG review, although it might move to Not currently under review is the idea is abandoned during the external review.",
"desc": "The IETF community and possibly other standards development organizations (SDOs) are reviewing the proposed charter. The usual next state is IESG review, although it might move to Not currently under review if the idea is abandoned during the external review.",
"name": "External review",
"next_states": [],
"order": 0,
@ -2128,6 +2128,45 @@
"model": "doc.state",
"pk": 146
},
{
"fields": {
"desc": "Replaced",
"name": "Replaced",
"next_states": [],
"order": 0,
"slug": "repl",
"type": "draft-stream-iab",
"used": true
},
"model": "doc.state",
"pk": 147
},
{
"fields": {
"desc": "Replaced",
"name": "Replaced",
"next_states": [],
"order": 0,
"slug": "repl",
"type": "draft-stream-ise",
"used": true
},
"model": "doc.state",
"pk": 148
},
{
"fields": {
"desc": "Replaced",
"name": "Replaced",
"next_states": [],
"order": 0,
"slug": "repl",
"type": "draft-stream-irtf",
"used": true
},
"model": "doc.state",
"pk": 149
},
{
"fields": {
"label": "State"
@ -8451,7 +8490,7 @@
},
{
"fields": {
"default_offset_days": -8,
"default_offset_days": -47,
"desc": "Early Bird registration and payment cut-off at UTC 23:59",
"name": "Earlybird cutoff",
"order": 0,
@ -8484,7 +8523,7 @@
},
{
"fields": {
"default_offset_days": -68,
"default_offset_days": -82,
"desc": "IETF Online Registration Opens",
"name": "Registration Opens",
"order": 0,
@ -8548,6 +8587,17 @@
"model": "name.importantdatename",
"pk": "revwgagenda"
},
{
"fields": {
"default_offset_days": -12,
"desc": "Standard rate registration and payment cut-off at UTC 23:59.",
"name": "Standard rate registration ends",
"order": 18,
"used": true
},
"model": "name.importantdatename",
"pk": "stdratecutoff"
},
{
"fields": {
"desc": "",
@ -10022,7 +10072,7 @@
"fields": {
"command": "xym",
"switch": "--version",
"time": "2018-03-23T00:08:43.130",
"time": "2018-05-03T00:07:54.849",
"used": true,
"version": "xym 0.4"
},
@ -10033,9 +10083,9 @@
"fields": {
"command": "pyang",
"switch": "--version",
"time": "2018-03-23T00:08:44.177",
"time": "2018-05-03T00:07:55.605",
"used": true,
"version": "pyang 1.7.4"
"version": "pyang 1.7.5"
},
"model": "utils.versioninfo",
"pk": 2
@ -10044,9 +10094,9 @@
"fields": {
"command": "yanglint",
"switch": "--version",
"time": "2018-03-23T00:08:44.295",
"time": "2018-05-03T00:07:55.737",
"used": true,
"version": "yanglint 0.14.73"
"version": "yanglint 0.14.78"
},
"model": "utils.versioninfo",
"pk": 3
@ -10055,7 +10105,7 @@
"fields": {
"command": "xml2rfc",
"switch": "--version",
"time": "2018-03-23T00:08:45.862",
"time": "2018-05-03T00:07:56.594",
"used": true,
"version": "xml2rfc 2.9.6"
},