summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-10-11 19:38:01 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-10-11 19:38:01 +0200
commitb1348c7d4a4f8432859c36217d87b20fdc359cb2 (patch)
treee5cff2c62caa46bd0929362f510b9d3b2fd59e7b /lib/Travelynx/Controller
parentb6330217f086360d865163e29285ea2bf6c79320 (diff)
move in_transit queries to an InTransit model class
Diffstat (limited to 'lib/Travelynx/Controller')
-rwxr-xr-xlib/Travelynx/Controller/Api.pm12
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm5
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm
index 8d2d2a7..74260c4 100755
--- a/lib/Travelynx/Controller/Api.pm
+++ b/lib/Travelynx/Controller/Api.pm
@@ -264,8 +264,10 @@ sub travel_v1 {
uid => $uid
);
if ( $payload->{comment} and not $error ) {
- $self->update_in_transit_comment(
- sanitize( q{}, $payload->{comment} ), $uid );
+ $self->in_transit->update_user_data(
+ uid => $uid,
+ user_data => { comment => sanitize( q{}, $payload->{comment} ) }
+ );
}
if ( $to_station and not $error ) {
( $train, $error ) = $self->checkout(
@@ -310,8 +312,10 @@ sub travel_v1 {
}
if ( $payload->{comment} ) {
- $self->update_in_transit_comment(
- sanitize( q{}, $payload->{comment} ), $uid );
+ $self->in_transit->update_user_data(
+ uid => $uid,
+ user_data => { comment => sanitize( q{}, $payload->{comment} ) }
+ );
}
my ( $train, $error ) = $self->checkout(
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 4df1558..6a1d1e1 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -1091,7 +1091,10 @@ sub comment_form {
}
else {
$self->app->log->debug("set comment");
- $self->update_in_transit_comment( $self->param('comment') );
+ $self->in_transit->update_user_data(
+ uid => $self->current_user->{id},
+ user_data => { comment => $self->param('comment') }
+ );
$self->redirect_to('/');
}
}