Skip to content

Commit 52bda85

Browse files
committed
Merged [5518] from suresh.krishnan@ericsson.com:
Checking for loss of comments when AD enters comments without changing state. Also modified the base css to have an unified errorlist format. - Legacy-Id: 5530 Note: SVN reference [5518] has been migrated to Git commit edfc7b8
2 parents ece709e + edfc7b8 commit 52bda85

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

ietf/idrfc/views_edit.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from django.utils.html import strip_tags
1313
from django.db.models import Max
1414
from django.conf import settings
15+
from django.forms.util import ErrorList
1516

1617
from ietf.utils.mail import send_mail_text, send_mail_message
1718
from ietf.ietfauth.decorators import group_required
@@ -49,6 +50,23 @@ class ChangeStateFormREDESIGN(forms.Form):
4950
substate = forms.ModelChoiceField(DocTagName.objects.filter(slug__in=IESG_SUBSTATE_TAGS), required=False)
5051
comment = forms.CharField(widget=forms.Textarea, required=False)
5152

53+
def clean(self):
54+
retclean = self.cleaned_data
55+
state = self.cleaned_data['state']
56+
tag = self.cleaned_data['substate']
57+
comment = self.cleaned_data['comment'].strip()
58+
doc = get_object_or_404(Document, docalias__name=self.docname)
59+
prev = doc.get_state("draft-iesg")
60+
61+
# tag handling is a bit awkward since the UI still works
62+
# as if IESG tags are a substate
63+
prev_tag = doc.tags.filter(slug__in=('point', 'ad-f-up', 'need-rev', 'extpty'))
64+
prev_tag = prev_tag[0] if prev_tag else None
65+
66+
if state == prev and tag == prev_tag:
67+
self._errors['comment'] = ErrorList([u'State not changed. Comments entered will be lost with no state change. Please go back and use the Add Comment feature on the history tab to add comments without changing state.'])
68+
return retclean
69+
5270
@group_required('Area_Director','Secretariat')
5371
def change_stateREDESIGN(request, name):
5472
"""Change state of Internet Draft, notifying parties as necessary
@@ -61,6 +79,7 @@ def change_stateREDESIGN(request, name):
6179

6280
if request.method == 'POST':
6381
form = ChangeStateForm(request.POST)
82+
form.docname=name
6483
if form.is_valid():
6584
next_state = form.cleaned_data['state']
6685
prev_state = doc.get_state("draft-iesg")
@@ -124,6 +143,7 @@ def change_stateREDESIGN(request, name):
124143
t = doc.tags.filter(slug__in=('point', 'ad-f-up', 'need-rev', 'extpty'))
125144
form = ChangeStateForm(initial=dict(state=state.pk if state else None,
126145
substate=t[0].pk if t else None))
146+
form.docname=name
127147

128148
state = doc.get_state("draft-iesg")
129149
next_states = state.next_states.all() if state else None

static/css/base2.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,6 @@ li.info { margin: 0.5em; background-color: #ff8; }
201201
li.success { margin: 0.5em; background-color: #4f4; }
202202
li.warning { margin: 0.5em; background-color: #fc8; color: black;}
203203
li.error { margin: 0.5em; background-color: #f44; }
204-
204+
205+
.errorlist { background: red; color: white; padding: 0.2ex 0.2ex 0.2ex 0.5ex; border: 0px; margin: 0px; font-family: Arial, sans-serif; }
206+

0 commit comments

Comments
 (0)