From 5461326f01f6b043f2dd0470788e03fd68790e5e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 4 Mar 2023 13:22:13 +0100 Subject: [PATCH] always show /p/user if /status/user exists; only limit past journeys --- lib/Travelynx/Controller/Traveling.pm | 68 ++++++++++++++------------- templates/privacy.html.ep | 13 ++--- 2 files changed, 43 insertions(+), 38 deletions(-) diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index a3274aa..1580bb6 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -638,10 +638,7 @@ sub public_profile { my $name = $self->stash('name'); my $user = $self->users->get_privacy_by_name( name => $name ); - if ( not $user - or $user->{past_visible} == 0 - or ( $user->{past_visible} == 1 and not $self->is_user_authenticated ) ) - { + if ( not $user ) { $self->render('not_found'); return; } @@ -677,38 +674,45 @@ sub public_profile { $status->{arr_name} = undef; } - my %opt = ( - uid => $user->{id}, - limit => 10, - with_datetime => 1 - ); + my @journeys; - if ( not $user->{past_all} ) { - my $now = DateTime->now( time_zone => 'Europe/Berlin' ); - $opt{before} = DateTime->now( time_zone => 'Europe/Berlin' ); - $opt{after} = $now->clone->subtract( weeks => 4 ); - } - - if ( - $user->{default_visibility_str} eq 'public' - or ( $user->{default_visibility_str} eq 'travelynx' - and $self->is_user_authenticated ) - ) + if ( $user->{past_visible} == 2 + or ( $user->{past_visible} == 1 and $self->is_user_authenticated ) ) { - $opt{with_default_visibility} = 1; - } - else { - $opt{with_default_visibility} = 0; - } - if ( $self->is_user_authenticated ) { - $opt{min_visibility} = 'travelynx'; - } - else { - $opt{min_visibility} = 'public'; - } + my %opt = ( + uid => $user->{id}, + limit => 10, + with_datetime => 1 + ); - my @journeys = $self->journeys->get(%opt); + if ( not $user->{past_all} ) { + my $now = DateTime->now( time_zone => 'Europe/Berlin' ); + $opt{before} = DateTime->now( time_zone => 'Europe/Berlin' ); + $opt{after} = $now->clone->subtract( weeks => 4 ); + } + + if ( + $user->{default_visibility_str} eq 'public' + or ( $user->{default_visibility_str} eq 'travelynx' + and $self->is_user_authenticated ) + ) + { + $opt{with_default_visibility} = 1; + } + else { + $opt{with_default_visibility} = 0; + } + + if ( $self->is_user_authenticated ) { + $opt{min_visibility} = 'travelynx'; + } + else { + $opt{min_visibility} = 'public'; + } + + @journeys = $self->journeys->get(%opt); + } $self->render( 'profile', diff --git a/templates/privacy.html.ep b/templates/privacy.html.ep index 9222591..57e3890 100644 --- a/templates/privacy.html.ep +++ b/templates/privacy.html.ep @@ -69,7 +69,7 @@
@@ -106,11 +106,12 @@
- Diese Einstellung bestimmt die Sichtbarkeit deines Profils unter /p/<%= $name %>. Bis zu zehn Fahrten, die - über die Standardeinstellung (siehe oben) oder per individueller - Einstellung für die aufrufende Person sichtbar sind, werden hier - verlinkt. + Diese Einstellung bestimmt die Sichtbarkeit vergangener Zugfahrten + unter /p/<%= $name %>. Vergangene + Fahrten, die über die Standardeinstellung (siehe oben) oder per + individueller Einstellung für die aufrufende Person sichtbar sind, + werden hier verlinkt. Derzeit werden nur die letzten zehn Fahrten + angezeigt; dies kann sich in Zukunft ändern.

Vergangenheit