summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-05-02 10:05:15 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-05-02 10:05:15 +0200
commit3de5de7db2b7eebe000c6534bfd020405921ccdc (patch)
treec57f9ea7cddbd99f21dd1a16760ddeabdc0079ce /lib
parent1bf128936d1af615bcbbf6aeb6d6ce5ab8179975 (diff)
Finish public-facing exposed user status (opt-in)
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Travelynx.pm1
-rw-r--r--lib/Travelynx/Controller/Account.pm4
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm2
3 files changed, 5 insertions, 2 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 8760135..8e10896 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -1729,6 +1729,7 @@ sub startup {
$r->get('/register')->to('account#registration_form');
$r->get('/reg/:id/:token')->to('account#verify');
$r->get('/status/:name')->to('traveling#user_status');
+ $r->get('/ajax/status/:name')->to('traveling#public_status_card');
$r->post('/action')->to('traveling#log_action');
$r->post('/geolocation')->to('traveling#geolocation');
$r->post('/list_departures')->to('traveling#redirect_to_station');
diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm
index 44babfa..f7d3a75 100644
--- a/lib/Travelynx/Controller/Account.pm
+++ b/lib/Travelynx/Controller/Account.pm
@@ -222,12 +222,12 @@ sub privacy {
$public_level &= ~0x02;
}
$self->set_privacy( $user->{id}, $public_level );
+ $self->redirect_to('account');
}
else {
$self->param( public_status => $public_level & 0x02 ? 1 : 0 );
+ $self->render( 'privacy', name => $user->{name} );
}
-
- $self->render( 'privacy', name => $user->{name} );
}
sub change_mail {
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index cf704ec..ee94913 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -50,6 +50,8 @@ sub public_status_card {
my $name = $self->stash('name');
my $user = $self->get_privacy_by_name($name);
+ delete $self->stash->{layout};
+
if ( $user and ( $user->{public_level} & 0x02 ) ) {
my $status = $self->get_user_status( $user->{id} );
$self->render(