traveling: redirect hafas journeys to hafas=1

This commit is contained in:
Birte Kristina Friesel 2023-08-14 12:35:22 +02:00
parent cc381d199f
commit 8f377d4ee5
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA

View file

@ -667,6 +667,9 @@ sub travel_action {
my ( $still_checked_in, undef ) = @_; my ( $still_checked_in, undef ) = @_;
if ( my $destination = $params->{dest} ) { if ( my $destination = $params->{dest} ) {
my $station_link = '/s/' . $destination; my $station_link = '/s/' . $destination;
if ( $status->{train_id} =~ m{[|]} ) {
$station_link .= '?hafas=1';
}
$self->render( $self->render(
json => { json => {
success => 1, success => 1,
@ -692,6 +695,7 @@ sub travel_action {
} }
elsif ( $params->{action} eq 'checkout' ) { elsif ( $params->{action} eq 'checkout' ) {
$self->render_later; $self->render_later;
my $status = $self->get_user_status;
$self->checkout_p( $self->checkout_p(
station => $params->{station}, station => $params->{station},
force => $params->{force} force => $params->{force}
@ -699,6 +703,9 @@ sub travel_action {
sub { sub {
my ( $still_checked_in, $error ) = @_; my ( $still_checked_in, $error ) = @_;
my $station_link = '/s/' . $params->{station}; my $station_link = '/s/' . $params->{station};
if ( $status->{train_id} =~ m{[|]} ) {
$station_link .= '?hafas=1';
}
if ($error) { if ($error) {
$self->render( $self->render(
@ -747,11 +754,11 @@ sub travel_action {
else { else {
my $redir = '/'; my $redir = '/';
if ( $status->{checked_in} or $status->{cancelled} ) { if ( $status->{checked_in} or $status->{cancelled} ) {
if ( $status->{dep_ds100} ) { if ( $status->{train_id} =~ m{[|]} ) {
$redir = '/s/' . $status->{dep_ds100}; $redir = '/s/' . $status->{dep_eva} . '?hafas=1';
} }
else { else {
$redir = '/s/' . $status->{dep_eva} . '?hafas=1'; $redir = '/s/' . $status->{dep_ds100};
} }
} }
$self->render( $self->render(