##// END OF EJS Templates
ux: fix bug where saving empty issue tracker form was causing...
dan -
r1000:dbebf42b default
parent child Browse files
Show More
@@ -397,19 +397,20 b' class SettingsController(BaseController)'
397 397 settings_model = IssueTrackerSettingsModel()
398 398
399 399 form = IssueTrackerPatternsForm()().to_python(request.POST)
400 for uid in form['delete_patterns']:
401 settings_model.delete_entries(uid)
400 if form:
401 for uid in form.get('delete_patterns', []):
402 settings_model.delete_entries(uid)
402 403
403 for pattern in form['patterns']:
404 for setting, value, type_ in pattern:
405 sett = settings_model.create_or_update_setting(
406 setting, value, type_)
407 Session().add(sett)
404 for pattern in form.get('patterns', []):
405 for setting, value, type_ in pattern:
406 sett = settings_model.create_or_update_setting(
407 setting, value, type_)
408 Session().add(sett)
408 409
409 Session().commit()
410 Session().commit()
410 411
411 SettingsModel().invalidate_settings_cache()
412 h.flash(_('Updated issue tracker entries'), category='success')
412 SettingsModel().invalidate_settings_cache()
413 h.flash(_('Updated issue tracker entries'), category='success')
413 414 return redirect(url('admin_settings_issuetracker'))
414 415
415 416 @HasPermissionAllDecorator('hg.admin')
@@ -494,6 +494,14 b' class TestAdminSettingsIssueTracker:'
494 494 response = self.app.get(url('admin_settings_issuetracker'))
495 495 assert response.status_code == 200
496 496
497 def test_add_empty_issuetracker_pattern(
498 self, request, autologin_user, csrf_token):
499 post_url = url('admin_settings_issuetracker_save')
500 post_data = {
501 'csrf_token': csrf_token
502 }
503 self.app.post(post_url, post_data, status=302)
504
497 505 def test_add_issuetracker_pattern(
498 506 self, request, autologin_user, csrf_token):
499 507 pattern = 'issuetracker_pat'
General Comments 0
You need to be logged in to leave comments. Login now