diff options
| author | Daniel Friesel <daniel.friesel@uos.de> | 2023-03-02 18:31:17 +0100 | 
|---|---|---|
| committer | Daniel Friesel <daniel.friesel@uos.de> | 2023-03-02 18:31:17 +0100 | 
| commit | 792ab9fe23a89682115ff02808e813dc92c597f8 (patch) | |
| tree | a44c25b8a2da831249c44ef7885e3e61cbabdbc3 /lib/Travelynx | |
| parent | 41985327e4b2dac9b9e089f738cfb6f77909790d (diff) | |
journey details: require valid token if too old
Diffstat (limited to 'lib/Travelynx')
| -rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 14 | 
1 files changed, 10 insertions, 4 deletions
| diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index f094279..316ee08 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -745,18 +745,26 @@ sub public_journey_details {  		return;  	} +	my $is_past; +	if ( not $user->{past_all} ) { +		my $now = DateTime->now( time_zone => 'Europe/Berlin' ); +		if ( $journey->{sched_dep_ts} < $now->subtract( weeks => 4 )->epoch ) { +			$is_past = 1; +		} +	} +  	my $visibility  	  = $self->compute_effective_visibility( $user->{default_visibility_str},  		$journey->{visibility_str} );  	if (  		not( -			$visibility eq 'public' +			( $visibility eq 'public' and not $is_past )  			or (    $visibility eq 'unlisted'  				and $self->journey_token_ok($journey) )  			or (  				$visibility eq 'travelynx' -				and (  $self->is_user_authenticated +				and ( ( $self->is_user_authenticated and not $is_past )  					or $self->journey_token_ok($journey) )  			)  		) @@ -771,8 +779,6 @@ sub public_journey_details {  		return;  	} -	# TODO re-add age check unless status_token_ok (helper function?) -  	my $title = sprintf( 'Fahrt von %s nach %s am %s',  		$journey->{from_name}, $journey->{to_name},  		$journey->{rt_arrival}->strftime('%d.%m.%Y') ); | 
