Allow callbacks to be removed

We’ve had a user who’s said:

> Seems configured callbacks cannot be removed once they’re set as the
> fields have a presence check. Is that intentional?

This means it’s not working as they expect. Rather than have to go and
change stuff in the database for them, let’s make it work as they’d
expect.

Only lets you clear the form if you remove both the token and the URL.
This commit is contained in:
Chris Hill-Scott
2018-04-26 17:23:44 +01:00
committed by Leo Hemsted
parent 418a744283
commit c2dbc1934f
5 changed files with 144 additions and 11 deletions

View File

@@ -826,7 +826,15 @@ class ServiceInboundNumberForm(StripWhitespaceForm):
)
class ServiceReceiveMessagesCallbackForm(StripWhitespaceForm):
class CallbackForm(StripWhitespaceForm):
def validate(self):
return super().validate() or (
self.url.data == '' and self.bearer_token.data == ''
)
class ServiceReceiveMessagesCallbackForm(CallbackForm):
url = StringField(
"URL",
validators=[DataRequired(message='Cant be empty'),
@@ -839,7 +847,7 @@ class ServiceReceiveMessagesCallbackForm(StripWhitespaceForm):
)
class ServiceDeliveryStatusCallbackForm(StripWhitespaceForm):
class ServiceDeliveryStatusCallbackForm(CallbackForm):
url = StringField(
"URL",
validators=[DataRequired(message='Cant be empty'),