Skip to content

Commit 39c3f6d

Browse files
committed
Fixes for state management by secretariat. Fixes ietf-tools#646
- Legacy-Id: 3019
1 parent c9241ed commit 39c3f6d

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

ietf/ietfworkflows/accounts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ def can_edit_state(user, draft):
3939
streamed = get_streamed_draft(draft)
4040
if not streamed or not streamed.stream:
4141
person = get_person_for_user(user)
42+
if not person:
43+
return False
4244
return (is_secretariat(user) or
4345
is_wgchair(person) or
4446
is_wgdelegate(person))

ietf/ietfworkflows/forms.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
update_state, FOLLOWUP_TAG,
1515
get_annotation_tags_for_draft,
1616
update_tags, update_stream)
17+
from ietf.ietfworkflows.accounts import is_secretariat
1718
from ietf.ietfworkflows.streams import (get_stream_from_draft, get_streamed_draft,
1819
get_stream_by_name, set_stream_for_draft)
1920
from ietf.ietfworkflows.constants import CALL_FOR_ADOPTION, IETF_STREAM
@@ -55,10 +56,14 @@ def __init__(self, *args, **kwargs):
5556
super(NoWorkflowStateForm, self).__init__(*args, **kwargs)
5657
self.wgs = None
5758
self.onlywg = None
58-
wgs = set(self.person.wgchair_set.all()).union(set(self.person.wgdelegate_set.all()))
59+
if is_secretariat(self.user):
60+
wgs = IETFWG.objects.all()
61+
else:
62+
wgs = set([i.group_acronym for i in self.person.wgchair_set.all()]).union(set([i.wg for i in self.person.wgdelegate_set.all()]))
5963
if len(wgs) > 1:
6064
self.wgs = list(wgs)
61-
self.fields['wg'].choices = [(i.group_acronym.pk, i.group_acronym.group_acronym.name) for i in self.wgs]
65+
self.wgs.sort(lambda x,y: cmp(x.group_acronym.acronym, y.group_acronym.acronym))
66+
self.fields['wg'].choices = [(i.pk, '%s - %s' % (i.group_acronym.acronym, i.group_acronym.name)) for i in self.wgs]
6267
else:
6368
self.onlywg = list(wgs)[0].group_acronym
6469

0 commit comments

Comments
 (0)