diff options
author | Daniel Friesel <derf@finalrewind.org> | 2023-03-04 13:22:13 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2023-03-04 13:22:13 +0100 |
commit | 5461326f01f6b043f2dd0470788e03fd68790e5e (patch) | |
tree | 8220720764155702c70d22803812a2f609c7c059 /lib | |
parent | 67dc1c203a83305612fc0118a47fca1ee8c8e422 (diff) |
always show /p/user if /status/user exists; only limit past journeys
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 68 |
1 files changed, 36 insertions, 32 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 - ); - - 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 ); - } + my @journeys; - 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 + ); + + 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 ); + } - my @journeys = $self->journeys->get(%opt); + 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', |