Skip to content

Commit cb051a7

Browse files
committed
Changed the handling of the milestone edit form to defer deletion if deletion is indicated together with other changes to the same milestone. Instead emit a warning, and ask for deletion without simultaneous changes to the milestone.
- Legacy-Id: 14761
1 parent 9287ce2 commit cb051a7

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

ietf/group/milestones.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import calendar
55

66
from django import forms
7+
from django.contrib import messages
78
from django.http import HttpResponseForbidden, HttpResponseBadRequest, HttpResponseRedirect, Http404
89
from django.shortcuts import render, redirect
910
from django.contrib.auth.decorators import login_required
@@ -155,23 +156,22 @@ def save_milestone_form(f):
155156

156157
if f.milestone:
157158
m = f.milestone
159+
initial_state = m.state_id
158160

159161
named_milestone = 'milestone "%s"' % m.desc
160162
if milestone_set == "charter":
161163
named_milestone = "charter " + named_milestone
162164

163-
if c["delete"]:
164-
save_milestone_in_history(m)
165-
166-
m.state_id = "deleted"
167-
m.save()
168-
169-
return 'Deleted %s' % named_milestone
170-
171165
# compute changes
172166
history = None
173167

174-
changes = ['Changed %s' % named_milestone]
168+
if c["delete"]:
169+
history = save_milestone_in_history(m)
170+
m.state_id = "deleted"
171+
172+
changes = ['Deleted %s' % named_milestone]
173+
else:
174+
changes = ['Changed %s' % named_milestone]
175175

176176
if m.state_id == "review" and not needs_review and c["review"] != "noaction":
177177
if not history:
@@ -231,6 +231,13 @@ def save_milestone_form(f):
231231
m.docs.set(new_docs)
232232

233233
if len(changes) > 1:
234+
if c["delete"]:
235+
messages.warning(request, "Found conflicting form data: both delete action and milestone changes for '%s'. "
236+
"Ignoring the delete; if delete is wanted, please mark for deletion without making other changes." % (m.desc, ))
237+
m.state_id = initial_state
238+
changes[0] = 'Changed %s' % named_milestone
239+
240+
234241
m.save()
235242

236243
return ", ".join(changes)

0 commit comments

Comments
 (0)