Skip to content

Commit 8d6bcc8

Browse files
committed
Fix adoption test to unset the stream, fix bugs with non-stream drafts
- Legacy-Id: 3852
1 parent 9cd0113 commit 8d6bcc8

4 files changed

Lines changed: 8 additions & 5 deletions

File tree

ietf/ietfworkflows/accounts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def can_edit_stream(user, draft):
118118
return is_secretariat(user)
119119

120120
def can_adopt(user, draft):
121-
if settings.USE_DB_REDESIGN_PROXY_CLASSES and draft.stream_id == "ietf" and draft.group.type_id == "individ":
121+
if settings.USE_DB_REDESIGN_PROXY_CLASSES and (not draft.stream or draft.stream_id == "ietf") and draft.group.type_id == "individ":
122122
person = get_person_for_user(user)
123123
if not person:
124124
return False

ietf/ietfworkflows/forms.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ def save(self):
9797
e.time = doc.time
9898
e.by = self.user.get_profile()
9999
e.doc = doc
100-
e.desc = u"Stream changed to <b>%s</b> from %s" % (new_stream.name, doc.stream.name)
100+
e.desc = u"Changed to <b>%s</b>" % new_stream.name
101+
if doc.stream:
102+
e.desc += u" from %s" % doc.stream.name
101103
e.save()
102104
doc.stream = new_stream
103105

ietf/ietfworkflows/streams.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class Dummy: pass
2727
def get_stream_from_draft(draft):
2828
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
2929
s = super(InternetDraft, draft).stream
30-
s.with_groups = s.slug in ["ietf", "irtf"]
30+
if s:
31+
s.with_groups = s.slug in ["ietf", "irtf"]
3132
return s
3233

3334
streamedid = get_streamed_draft(draft)

ietf/ietfworkflows/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class EditStreamInfoTestCase(django.test.TestCase):
2323

2424
def test_adopt_document(self):
2525
draft = make_test_data()
26-
draft.stream_id = "ise"
26+
draft.stream = None
2727
draft.group = Group.objects.get(type="individ")
28-
draft.unset_state("draft-stream-ietf")
2928
draft.save()
29+
draft.unset_state("draft-stream-ietf")
3030

3131
url = urlreverse('edit_adopt', kwargs=dict(name=draft.name))
3232
login_testing_unauthorized(self, "marschairman", url)

0 commit comments

Comments
 (0)