diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-12-14 23:46:36 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-12-14 23:46:36 +0100 |
commit | 7ae60f2ea44aa61ed0d9451c4389b6d7630d583e (patch) | |
tree | cc0cddad42d299a9815d7d2b06579c6a144266f8 /lib/Travelynx/Controller | |
parent | 46fc64de4831e90971c4a3db91d6fcfa3628a2d0 (diff) |
Travel API: comment support
Diffstat (limited to 'lib/Travelynx/Controller')
-rwxr-xr-x | lib/Travelynx/Controller/Api.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index f420a9e..2e1fa49 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -260,6 +260,10 @@ sub travel_v1 { my ( $train, $error ) = $self->checkin( $from_station, $train_id, $uid ); + if ( $payload->{comment} ) { + $self->update_in_transit_comment( + sanitize( q{}, $payload->{comment} ), $uid ); + } if ( $to_station and not $error ) { ( $train, $error ) = $self->checkout( $to_station, 0, $uid ); } @@ -284,6 +288,11 @@ sub travel_v1 { elsif ( $payload->{action} eq 'checkout' ) { my $to_station = sanitize( q{}, $payload->{toStation} ); + if ( $payload->{comment} ) { + $self->update_in_transit_comment( + sanitize( q{}, $payload->{comment} ), $uid ); + } + my ( $train, $error ) = $self->checkout( $to_station, $payload->{force} ? 1 : 0, $uid ); if ($error) { |