summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-05-05 18:09:11 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-05-05 18:09:11 +0200
commitb36ba45aef6ce3a62079064a900915a9e222acde (patch)
tree600467fbed7d3bfae6050fdbff90130a8dbf8385 /lib/Travelynx/Controller
parent55581d1f257eeff7e509cb03f3eeed7e2da6f3a9 (diff)
WiP webhook support
Diffstat (limited to 'lib/Travelynx/Controller')
-rw-r--r--lib/Travelynx/Controller/Account.pm25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm
index 8d5b21f..75b8f02 100644
--- a/lib/Travelynx/Controller/Account.pm
+++ b/lib/Travelynx/Controller/Account.pm
@@ -230,6 +230,31 @@ sub privacy {
}
}
+sub webhook {
+ my ($self) = @_;
+
+ my $hook = $self->get_webhook;
+
+ if ( $self->param('action') and $self->param('action') eq 'save' ) {
+ $hook->{url} = $self->param('url');
+ $hook->{token} = $self->param('token');
+ $hook->{enabled} = $self->param('enabled') // 0;
+ $self->set_webhook(
+ url => $hook->{url},
+ token => $hook->{token},
+ enabled => $hook->{enabled}
+ );
+ $hook = $self->get_webhook;
+ }
+ else {
+ $self->param( url => $hook->{url} );
+ $self->param( token => $hook->{token} );
+ $self->param( enabled => $hook->{enabled} );
+ }
+
+ $self->render( 'webhooks', hook => $hook );
+}
+
sub change_mail {
my ($self) = @_;