diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-12-06 21:42:26 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-12-06 21:44:31 +0100 |
commit | fb126c69289abf7174f53b0d04f56f195e0fbd12 (patch) | |
tree | 7e80d49575891f90132b05a95ab5a242260de53e /lib | |
parent | 094c536eb475b02a26f65769d6ff460d270ef454 (diff) |
optionally show journey comment in public user status
Closes #19
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travelynx/Controller/Account.pm | 13 | ||||
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 12 |
2 files changed, 17 insertions, 8 deletions
diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm index 0275b96..cebe21a 100644 --- a/lib/Travelynx/Controller/Account.pm +++ b/lib/Travelynx/Controller/Account.pm @@ -65,7 +65,7 @@ sub register { my $password2 = $self->req->param('password2'); my $ip = $self->req->headers->header('X-Forwarded-For'); my $ua = $self->req->headers->user_agent; - my $date = DateTime->now( time_zone => 'Europe/Berlin' ) + my $date = DateTime->now( time_zone => 'Europe/Berlin' ) ->strftime('%d.%m.%Y %H:%M:%S %z'); # In case Mojolicious is not running behind a reverse proxy @@ -221,13 +221,20 @@ sub privacy { else { $public_level &= ~0x02; } + if ( $self->param('public_comment') ) { + $public_level |= 0x04; + } + else { + $public_level &= ~0x04; + } $self->set_privacy( $user->{id}, $public_level ); $self->flash( success => 'privacy' ); $self->redirect_to('account'); } else { - $self->param( public_status => $public_level & 0x02 ? 1 : 0 ); + $self->param( public_status => $public_level & 0x02 ? 1 : 0 ); + $self->param( public_comment => $public_level & 0x04 ? 1 : 0 ); $self->render( 'privacy', name => $user->{name} ); } } @@ -640,7 +647,7 @@ sub json_export { $self->render( json => { - account => $db->select( 'users', '*', { id => $uid } )->hash, + account => $db->select( 'users', '*', { id => $uid } )->hash, in_transit => [ $db->select( 'in_transit_str', '*', { user_id => $uid } ) ->hashes->each diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index f41d8df..3f8f37e 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -75,9 +75,10 @@ sub user_status { $self->render( 'user_status', - name => $name, - journey => $status, - twitter => \%tw_data, + name => $name, + public_level => $user->{public_level}, + journey => $status, + twitter => \%tw_data, ); } else { @@ -97,8 +98,9 @@ sub public_status_card { my $status = $self->get_user_status( $user->{id} ); $self->render( '_public_status_card', - name => $name, - journey => $status + name => $name, + public_level => $user->{public_level}, + journey => $status ); } else { |