mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
- Change update service name to check that the name/email_from is unique across all services.
- This is done using a new endpoint in the api. - Removed the AddServiceForm in favor or using the ServiceNameForm - Removed ServiceApiClient.find_all_service_email_from
This commit is contained in:
@@ -14,7 +14,7 @@ from notifications_python_client.errors import HTTPError
|
||||
from werkzeug.exceptions import abort
|
||||
|
||||
from app.main import main
|
||||
from app.main.forms import AddServiceForm
|
||||
from app.main.forms import ServiceNameForm
|
||||
from app.notify_client.models import InvitedUser
|
||||
|
||||
from app import (
|
||||
@@ -78,7 +78,7 @@ def add_service():
|
||||
if not is_gov_user(current_user.email_address):
|
||||
abort(403)
|
||||
|
||||
form = AddServiceForm()
|
||||
form = ServiceNameForm()
|
||||
heading = 'Which service do you want to set up notifications for?'
|
||||
|
||||
if form.validate_on_submit():
|
||||
|
||||
@@ -81,12 +81,16 @@ def service_settings(service_id):
|
||||
@login_required
|
||||
@user_has_permissions('manage_settings', admin_override=True)
|
||||
def service_name_change(service_id):
|
||||
form = ServiceNameForm(service_api_client.find_all_service_email_from)
|
||||
form = ServiceNameForm()
|
||||
|
||||
if request.method == 'GET':
|
||||
form.name.data = current_service.get('name')
|
||||
|
||||
if form.validate_on_submit():
|
||||
unique_name = service_api_client.is_service_name_unique(form.name.data, email_safe(form.name.data))
|
||||
if not unique_name:
|
||||
form.name.errors.append("This service name is already in use")
|
||||
return render_template('views/service-settings/name.html', form=form)
|
||||
session['service_name_change'] = form.name.data
|
||||
return redirect(url_for('.service_name_change_confirm', service_id=service_id))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user