summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2023-03-04 13:22:13 +0100
committerDaniel Friesel <derf@finalrewind.org>2023-03-04 13:22:13 +0100
commit5461326f01f6b043f2dd0470788e03fd68790e5e (patch)
tree8220720764155702c70d22803812a2f609c7c059 /lib
parent67dc1c203a83305612fc0118a47fca1ee8c8e422 (diff)
always show /p/user if /status/user exists; only limit past journeys
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm68
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',