Skip to content

Commit 0f4ae8f

Browse files
committed
Merged in [8608] from rjsparks@nostrum.com:\n Allow chosing the initial state when beginning WG processing of a draft. Fixes bug ietf-tools#1406.
- Legacy-Id: 8615 Note: SVN reference [8608] has been migrated to Git commit 696e932
2 parents 8b93881 + 696e932 commit 0f4ae8f

4 files changed

Lines changed: 17 additions & 13 deletions

File tree

ietf/doc/tests_draft.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,9 +1077,11 @@ def test_adopt_document(self):
10771077
mailbox_before = len(outbox)
10781078
events_before = draft.docevent_set.count()
10791079
mars = Group.objects.get(acronym="mars")
1080+
call_issued = State.objects.get(type='draft-stream-ietf',slug='c-adopt')
10801081
r = self.client.post(url,
10811082
dict(comment="some comment",
10821083
group=mars.pk,
1084+
newstate=call_issued.pk,
10831085
weeks="10"))
10841086
self.assertEqual(r.status_code, 302)
10851087

ietf/doc/views_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def document_main(request, name, rev=None):
299299
actions = []
300300

301301
if can_adopt_draft(request.user, doc):
302-
actions.append(("Adopt in Group", urlreverse('doc_adopt_draft', kwargs=dict(name=doc.name))))
302+
actions.append(("Manage Document Adoption in Group", urlreverse('doc_adopt_draft', kwargs=dict(name=doc.name))))
303303

304304
if doc.get_state_slug() == "expired" and not resurrected_by and can_edit:
305305
actions.append(("Request Resurrect", urlreverse('doc_request_resurrect', kwargs=dict(name=doc.name))))

ietf/doc/views_draft.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,7 @@ def request_publication(request, name):
12091209

12101210
class AdoptDraftForm(forms.Form):
12111211
group = forms.ModelChoiceField(queryset=Group.objects.filter(type__in=["wg", "rg"], state="active").order_by("-type", "acronym"), required=True, empty_label=None)
1212+
newstate = forms.ModelChoiceField(queryset=State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'],slug__in=['wg-cand', 'c-adopt', 'adopt-wg', 'info', 'wg-doc', 'candidat','active']),required=True,label="State")
12121213
comment = forms.CharField(widget=forms.Textarea, required=False, label="Comment", help_text="Optional comment explaining the reasons for the adoption")
12131214
weeks = forms.IntegerField(required=False, label="Expected weeks in adoption state")
12141215

@@ -1218,17 +1219,21 @@ def __init__(self, *args, **kwargs):
12181219
super(AdoptDraftForm, self).__init__(*args, **kwargs)
12191220

12201221
if has_role(user, "Secretariat"):
1221-
pass # all groups
1222+
state_choices = State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'],slug__in=['wg-cand', 'c-adopt', 'adopt-wg', 'info', 'wg-doc', 'candidat','active'])
12221223
elif has_role(user, "IRTF Chair"):
12231224
#The IRTF chair can adopt a draft into any RG
12241225
group_ids = list(Group.objects.filter(type="rg", state="active").values_list('id', flat=True))
12251226
group_ids.extend(list(Group.objects.filter(type="wg", state="active", role__person__user=user, role__name__in=("chair", "delegate", "secr")).values_list('id', flat=True)))
12261227
self.fields["group"].queryset = self.fields["group"].queryset.filter(id__in=group_ids).distinct()
1228+
state_choices = State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'],slug__in=['wg-cand', 'c-adopt', 'adopt-wg', 'info', 'wg-doc', 'candidat','active'])
12271229
else:
12281230
self.fields["group"].queryset = self.fields["group"].queryset.filter(role__person__user=user, role__name__in=("chair", "delegate", "secr")).distinct()
1231+
state_choices = State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'],slug__in=['wg-cand', 'c-adopt', 'adopt-wg', 'info', 'wg-doc'])
12291232

12301233
self.fields['group'].choices = [(g.pk, '%s - %s' % (g.acronym, g.name)) for g in self.fields["group"].queryset]
12311234

1235+
self.fields['newstate'].choices = [(x.pk,x.name) for x in state_choices]
1236+
self.fields['newstate'].choices.insert(0,('','--------'))
12321237

12331238
@login_required
12341239
def adopt_draft(request, name):
@@ -1251,10 +1256,10 @@ def adopt_draft(request, name):
12511256
group = form.cleaned_data["group"]
12521257
if group.type.slug == "rg":
12531258
new_stream = StreamName.objects.get(slug="irtf")
1254-
adopt_state_slug = "active"
12551259
else:
12561260
new_stream = StreamName.objects.get(slug="ietf")
1257-
adopt_state_slug = "c-adopt"
1261+
1262+
new_state = form.cleaned_data["newstate"]
12581263

12591264
# stream
12601265
if doc.stream != new_stream:
@@ -1287,7 +1292,6 @@ def adopt_draft(request, name):
12871292

12881293
# state
12891294
prev_state = doc.get_state("draft-stream-%s" % doc.stream_id)
1290-
new_state = State.objects.get(slug=adopt_state_slug, type="draft-stream-%s" % doc.stream_id, used=True)
12911295
if new_state != prev_state:
12921296
doc.set_state(new_state)
12931297
e = add_state_change_event(doc, by, prev_state, new_state, timestamp=doc.time)

ietf/templates/doc/draft/adopt_draft.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends "base.html" %}
22

3-
{% block title %}Adopt {{ doc }} in Group{% endblock %}
3+
{% block title %}Manage Document Adoption of {{ doc }} in Group{% endblock %}
44

55
{% block morecss %}
66
form.adopt-draft th { width: 8em; }
@@ -11,14 +11,12 @@
1111
{% endblock %}
1212

1313
{% block content %}
14-
<h1>Adopt {{ doc }} in Group</h1>
14+
<h1>Manage Document Adoption of {{ doc }} in Group</h1>
1515

16-
<p class="intro">You can adopt this draft into a group.</p>
16+
<p class="intro">You can begin managing the group state of this draft.</p>
1717

18-
<p class="intro">For a WG, the draft enters the IETF stream and the
19-
stream state becomes "Call for Adoption by WG Issued". For an RG, the
20-
draft enters the IRTF stream and the stream state becomes "Active RG
21-
Document".</p>
18+
<p class="intro">For a WG, the draft enters the IETF stream.
19+
For an RG, the draft enters the IRTF stream.</p>
2220

2321
<form class="adopt-draft" action="" method="post">{% csrf_token %}
2422
{% for field in form.hidden_fields %}{{ field }}{% endfor %}
@@ -35,7 +33,7 @@ <h1>Adopt {{ doc }} in Group</h1>
3533
<tr>
3634
<td colspan="2" class="actions">
3735
<a class="button" href="{{ doc.get_absolute_url }}">Cancel</a>
38-
<input class="button" type="submit" value="Adopt Draft"/>
36+
<input class="button" type="submit" value="Save"/>
3937
</td>
4038
</tr>
4139
</table>

0 commit comments

Comments
 (0)