Merged [2625] from lars.eggert@nokia.com:
Fix #456 and #537. * Make it possible for an IESG member to add a comment (for the document history) in the change - Legacy-Id: 2637 Note: SVN reference [2625] has been migrated to Git commit 9e2820df4215bab1258759432d90921f27c66579
This commit is contained in:
parent
4faace8f05
commit
979bdb4c00
|
@ -1,15 +1,11 @@
|
|||
from ietf.idtracker.models import InternetDraft, DocumentComment, BallotInfo, IESGLogin
|
||||
from ietf.idrfc.mails import *
|
||||
|
||||
def add_document_comment(request, doc, text, include_by=True, ballot=None):
|
||||
def add_document_comment(request, doc, text, ballot=None):
|
||||
if request:
|
||||
login = IESGLogin.objects.get(login_name=request.user.username)
|
||||
if include_by:
|
||||
text += " by %s" % login
|
||||
else:
|
||||
login = None
|
||||
if include_by:
|
||||
text += " by %s" % "system"
|
||||
|
||||
c = DocumentComment()
|
||||
c.document = doc.idinternal
|
||||
|
@ -33,12 +29,13 @@ def generate_ballot(request, doc):
|
|||
doc.idinternal.ballot = ballot
|
||||
return ballot
|
||||
|
||||
def log_state_changed(request, doc, by, email_watch_list=True):
|
||||
change = u"State changed to <b>%s</b> from <b>%s</b> by %s" % (
|
||||
def log_state_changed(request, doc, by, email_watch_list=True, note=''):
|
||||
change = u"State changed to <b>%s</b> from %s." % (
|
||||
doc.idinternal.docstate(),
|
||||
format_document_state(doc.idinternal.prev_state,
|
||||
doc.idinternal.prev_sub_state),
|
||||
by)
|
||||
doc.idinternal.prev_sub_state))
|
||||
if note:
|
||||
change += "<br>%s" % note
|
||||
|
||||
c = DocumentComment()
|
||||
c.document = doc.idinternal
|
||||
|
|
|
@ -26,6 +26,7 @@ from ietf.idrfc.lastcall import request_last_call
|
|||
class ChangeStateForm(forms.Form):
|
||||
state = forms.ModelChoiceField(IDState.objects.all(), empty_label=None, required=True)
|
||||
substate = forms.ModelChoiceField(IDSubState.objects.all(), required=False)
|
||||
note = forms.CharField(widget=forms.Textarea, label="Comment", required=False)
|
||||
|
||||
@group_required('Area_Director','Secretariat')
|
||||
def change_state(request, name):
|
||||
|
@ -42,6 +43,7 @@ def change_state(request, name):
|
|||
if form.is_valid():
|
||||
state = form.cleaned_data['state']
|
||||
sub_state = form.cleaned_data['substate']
|
||||
note = form.cleaned_data['note']
|
||||
internal = doc.idinternal
|
||||
if state != internal.cur_state or sub_state != internal.cur_sub_state:
|
||||
internal.change_state(state, sub_state)
|
||||
|
@ -49,7 +51,7 @@ def change_state(request, name):
|
|||
internal.mark_by = login
|
||||
internal.save()
|
||||
|
||||
change = log_state_changed(request, doc, login)
|
||||
change = log_state_changed(request, doc, login, note=note)
|
||||
email_owner(request, doc, internal.job_owner, login, change)
|
||||
|
||||
if internal.cur_state.document_state_id == IDState.LAST_CALL_REQUESTED:
|
||||
|
@ -222,7 +224,7 @@ def edit_info(request, name):
|
|||
replaces = doc.replaces_set.all()
|
||||
if replaces:
|
||||
c = "Earlier history may be found in the Comment Log for <a href=\"%s\">%s</a>" % (replaces[0], replaces[0].idinternal.get_absolute_url())
|
||||
add_document_comment(request, doc, c, include_by=False)
|
||||
add_document_comment(request, doc, c)
|
||||
|
||||
orig_job_owner = doc.idinternal.job_owner
|
||||
|
||||
|
@ -370,7 +372,7 @@ def add_comment(request, name):
|
|||
form = AddCommentForm(request.POST)
|
||||
if form.is_valid():
|
||||
c = form.cleaned_data['comment']
|
||||
add_document_comment(request, doc, c, include_by=False)
|
||||
add_document_comment(request, doc, c)
|
||||
email_owner(request, doc, doc.idinternal.job_owner, login,
|
||||
"A new comment added by %s" % login)
|
||||
return HttpResponseRedirect(doc.idinternal.get_absolute_url())
|
||||
|
|
Loading…
Reference in a new issue