mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 17:38:50 -04:00
Rename form objects to remove the term ‘whitelist’
See c31264d4c for rationale. To avoid confusion the codebase should use
the same terminology as the UI.
This commit is contained in:
@@ -1241,26 +1241,26 @@ class PDFUploadForm(StripWhitespaceForm):
|
||||
)
|
||||
|
||||
|
||||
class EmailFieldInWhitelist(EmailField, StripWhitespaceStringField):
|
||||
class EmailFieldInGuestList(EmailField, StripWhitespaceStringField):
|
||||
pass
|
||||
|
||||
|
||||
class InternationalPhoneNumberInWhitelist(InternationalPhoneNumber, StripWhitespaceStringField):
|
||||
class InternationalPhoneNumberInGuestList(InternationalPhoneNumber, StripWhitespaceStringField):
|
||||
pass
|
||||
|
||||
|
||||
class Whitelist(StripWhitespaceForm):
|
||||
class GuestList(StripWhitespaceForm):
|
||||
|
||||
def populate(self, email_addresses, phone_numbers):
|
||||
for form_field, existing_whitelist in (
|
||||
for form_field, existing_guest_list in (
|
||||
(self.email_addresses, email_addresses),
|
||||
(self.phone_numbers, phone_numbers)
|
||||
):
|
||||
for index, value in enumerate(existing_whitelist):
|
||||
for index, value in enumerate(existing_guest_list):
|
||||
form_field[index].data = value
|
||||
|
||||
email_addresses = FieldList(
|
||||
EmailFieldInWhitelist(
|
||||
EmailFieldInGuestList(
|
||||
'',
|
||||
validators=[
|
||||
Optional(),
|
||||
@@ -1274,7 +1274,7 @@ class Whitelist(StripWhitespaceForm):
|
||||
)
|
||||
|
||||
phone_numbers = FieldList(
|
||||
InternationalPhoneNumberInWhitelist(
|
||||
InternationalPhoneNumberInGuestList(
|
||||
'',
|
||||
validators=[
|
||||
Optional()
|
||||
|
||||
@@ -18,9 +18,9 @@ from app import (
|
||||
from app.main import main
|
||||
from app.main.forms import (
|
||||
CreateKeyForm,
|
||||
GuestList,
|
||||
ServiceDeliveryStatusCallbackForm,
|
||||
ServiceReceiveMessagesCallbackForm,
|
||||
Whitelist,
|
||||
)
|
||||
from app.notify_client.api_key_api_client import (
|
||||
KEY_TYPE_NORMAL,
|
||||
@@ -55,7 +55,7 @@ def api_documentation(service_id):
|
||||
@main.route("/services/<uuid:service_id>/api/whitelist", methods=['GET', 'POST'])
|
||||
@user_has_permissions('manage_api_keys')
|
||||
def whitelist(service_id):
|
||||
form = Whitelist()
|
||||
form = GuestList()
|
||||
if form.validate_on_submit():
|
||||
service_api_client.update_whitelist(service_id, {
|
||||
'email_addresses': list(filter(None, form.email_addresses.data)),
|
||||
|
||||
Reference in New Issue
Block a user