mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -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
|
pass
|
||||||
|
|
||||||
|
|
||||||
class InternationalPhoneNumberInWhitelist(InternationalPhoneNumber, StripWhitespaceStringField):
|
class InternationalPhoneNumberInGuestList(InternationalPhoneNumber, StripWhitespaceStringField):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Whitelist(StripWhitespaceForm):
|
class GuestList(StripWhitespaceForm):
|
||||||
|
|
||||||
def populate(self, email_addresses, phone_numbers):
|
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.email_addresses, email_addresses),
|
||||||
(self.phone_numbers, phone_numbers)
|
(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
|
form_field[index].data = value
|
||||||
|
|
||||||
email_addresses = FieldList(
|
email_addresses = FieldList(
|
||||||
EmailFieldInWhitelist(
|
EmailFieldInGuestList(
|
||||||
'',
|
'',
|
||||||
validators=[
|
validators=[
|
||||||
Optional(),
|
Optional(),
|
||||||
@@ -1274,7 +1274,7 @@ class Whitelist(StripWhitespaceForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
phone_numbers = FieldList(
|
phone_numbers = FieldList(
|
||||||
InternationalPhoneNumberInWhitelist(
|
InternationalPhoneNumberInGuestList(
|
||||||
'',
|
'',
|
||||||
validators=[
|
validators=[
|
||||||
Optional()
|
Optional()
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ from app import (
|
|||||||
from app.main import main
|
from app.main import main
|
||||||
from app.main.forms import (
|
from app.main.forms import (
|
||||||
CreateKeyForm,
|
CreateKeyForm,
|
||||||
|
GuestList,
|
||||||
ServiceDeliveryStatusCallbackForm,
|
ServiceDeliveryStatusCallbackForm,
|
||||||
ServiceReceiveMessagesCallbackForm,
|
ServiceReceiveMessagesCallbackForm,
|
||||||
Whitelist,
|
|
||||||
)
|
)
|
||||||
from app.notify_client.api_key_api_client import (
|
from app.notify_client.api_key_api_client import (
|
||||||
KEY_TYPE_NORMAL,
|
KEY_TYPE_NORMAL,
|
||||||
@@ -55,7 +55,7 @@ def api_documentation(service_id):
|
|||||||
@main.route("/services/<uuid:service_id>/api/whitelist", methods=['GET', 'POST'])
|
@main.route("/services/<uuid:service_id>/api/whitelist", methods=['GET', 'POST'])
|
||||||
@user_has_permissions('manage_api_keys')
|
@user_has_permissions('manage_api_keys')
|
||||||
def whitelist(service_id):
|
def whitelist(service_id):
|
||||||
form = Whitelist()
|
form = GuestList()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
service_api_client.update_whitelist(service_id, {
|
service_api_client.update_whitelist(service_id, {
|
||||||
'email_addresses': list(filter(None, form.email_addresses.data)),
|
'email_addresses': list(filter(None, form.email_addresses.data)),
|
||||||
|
|||||||
Reference in New Issue
Block a user