Add webhook to account page
This commit is contained in:
parent
3f4cf9ee42
commit
269b8536f4
3 changed files with 33 additions and 5 deletions
|
@ -1045,7 +1045,7 @@ sub startup {
|
||||||
$self->pg->db->update(
|
$self->pg->db->update(
|
||||||
'webhooks',
|
'webhooks',
|
||||||
{
|
{
|
||||||
errored => !$success,
|
errored => $success ? 0 : 1,
|
||||||
latest_run => DateTime->now( time_zone => 'Europe/Berlin' ),
|
latest_run => DateTime->now( time_zone => 'Europe/Berlin' ),
|
||||||
output => $text,
|
output => $text,
|
||||||
},
|
},
|
||||||
|
|
|
@ -222,6 +222,8 @@ sub privacy {
|
||||||
$public_level &= ~0x02;
|
$public_level &= ~0x02;
|
||||||
}
|
}
|
||||||
$self->set_privacy( $user->{id}, $public_level );
|
$self->set_privacy( $user->{id}, $public_level );
|
||||||
|
|
||||||
|
$self->flash( success => 'privacy' );
|
||||||
$self->redirect_to('account');
|
$self->redirect_to('account');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -244,8 +246,9 @@ sub webhook {
|
||||||
token => $hook->{token},
|
token => $hook->{token},
|
||||||
enabled => $hook->{enabled}
|
enabled => $hook->{enabled}
|
||||||
);
|
);
|
||||||
|
$self->flash( success => 'webhook' );
|
||||||
|
$self->redirect_to('account');
|
||||||
$self->run_hook( $self->current_user->{id}, 'ping' );
|
$self->run_hook( $self->current_user->{id}, 'ping' );
|
||||||
$hook = $self->get_webhook;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$self->param( url => $hook->{url} );
|
$self->param( url => $hook->{url} );
|
||||||
|
|
|
@ -8,10 +8,16 @@
|
||||||
<div class="card green darken-4">
|
<div class="card green darken-4">
|
||||||
<div class="card-content white-text">
|
<div class="card-content white-text">
|
||||||
% if ($success eq 'mail') {
|
% if ($success eq 'mail') {
|
||||||
<span class="card-title">Mail-Adresse erfolgreich geändert</span>
|
<span class="card-title">Mail-Adresse geändert</span>
|
||||||
% }
|
% }
|
||||||
% elsif ($success eq 'password') {
|
% elsif ($success eq 'password') {
|
||||||
<span class="card-title">Passwort erfolgreich geändert</span>
|
<span class="card-title">Passwort geändert</span>
|
||||||
|
% }
|
||||||
|
% elsif ($success eq 'privacy') {
|
||||||
|
<span class="card-title">Einstellungen zu öffentliche Account-Daten geändert</span>
|
||||||
|
% }
|
||||||
|
% elsif ($success eq 'webhook') {
|
||||||
|
<span class="card-title">Web Hook aktualisiert</span>
|
||||||
% }
|
% }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,6 +27,7 @@
|
||||||
|
|
||||||
<h1>Account</h1>
|
<h1>Account</h1>
|
||||||
% my $acc = current_user();
|
% my $acc = current_user();
|
||||||
|
% my $hook = get_webhook();
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12">
|
<div class="col s12">
|
||||||
<table class="striped">
|
<table class="striped">
|
||||||
|
@ -41,13 +48,31 @@
|
||||||
<td>
|
<td>
|
||||||
<a href="/account/privacy"><i class="material-icons">edit</i></a>
|
<a href="/account/privacy"><i class="material-icons">edit</i></a>
|
||||||
% if ($acc->{is_public} == 0) {
|
% if ($acc->{is_public} == 0) {
|
||||||
Keine
|
<span style="color: #999999;">Keine</span>
|
||||||
% }
|
% }
|
||||||
% if ($acc->{is_public} & 0x02) {
|
% if ($acc->{is_public} & 0x02) {
|
||||||
Aktueller Status
|
Aktueller Status
|
||||||
% }
|
% }
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Web Hook</th>
|
||||||
|
<td>
|
||||||
|
<a href="/account/hooks"><i class="material-icons">edit</i></a>
|
||||||
|
% if ($hook->{enabled} == 0) {
|
||||||
|
<span style="color: #999999;">Nicht eingerichtet</span>
|
||||||
|
% }
|
||||||
|
% elsif ($hook->{latest_run}->epoch == 0) {
|
||||||
|
Aktiv, noch nicht ausgeführt
|
||||||
|
% }
|
||||||
|
% elsif ($hook->{errored}) {
|
||||||
|
Aktiv, fehlerhaft <i class="material-icons">error</i>
|
||||||
|
% }
|
||||||
|
% else {
|
||||||
|
Aktiv
|
||||||
|
% }
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Registriert am</th>
|
<th scope="row">Registriert am</th>
|
||||||
<td><%= $acc->{registered_at}->strftime('%d.%m.%Y %H:%M') %></td>
|
<td><%= $acc->{registered_at}->strftime('%d.%m.%Y %H:%M') %></td>
|
||||||
|
|
Loading…
Reference in a new issue