summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller/Profile.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travelynx/Controller/Profile.pm')
-rwxr-xr-xlib/Travelynx/Controller/Profile.pm46
1 files changed, 45 insertions, 1 deletions
diff --git a/lib/Travelynx/Controller/Profile.pm b/lib/Travelynx/Controller/Profile.pm
index c35642d..8f3a1b2 100755
--- a/lib/Travelynx/Controller/Profile.pm
+++ b/lib/Travelynx/Controller/Profile.pm
@@ -111,6 +111,14 @@ sub profile {
$status->{arr_name} = undef;
}
+ my $map_data = {};
+ if ( $status->{checked_in} ) {
+ $map_data = $self->journeys_to_map_data(
+ journeys => [$status],
+ with_now_markers => 1,
+ );
+ }
+
my @journeys;
if (
@@ -190,6 +198,8 @@ sub profile {
: 0,
journey => $status,
journeys => [@journeys],
+ with_map => 1,
+ %{$map_data},
}
);
}
@@ -359,6 +369,21 @@ sub user_status {
return;
}
+ if ( not $ts =~ m{ ^ \d+ [.]? \d* $ }x ) {
+ $self->respond_to(
+ json => {
+ json => { error => 'bad request (invalid timestamp)' },
+ status => 400,
+ },
+ any => {
+ template => 'bad_request',
+ message => 'Invalid timestamp',
+ status => 400
+ }
+ );
+ return;
+ }
+
my $my_user;
my $relation;
my $inverse_relation;
@@ -494,6 +519,14 @@ sub user_status {
$og_data{description} = $tw_data{description} = q{};
}
+ my $map_data = {};
+ if ( $status->{checked_in} ) {
+ $map_data = $self->journeys_to_map_data(
+ journeys => [$status],
+ with_now_markers => 1,
+ );
+ }
+
$self->respond_to(
json => {
json => {
@@ -516,7 +549,9 @@ sub user_status {
journey => $status,
twitter => \%tw_data,
opengraph => \%og_data,
- version => $self->app->config->{version} // 'UNKNOWN',
+ with_map => 1,
+ %{$map_data},
+ version => $self->app->config->{version} // 'UNKNOWN',
},
);
}
@@ -555,6 +590,7 @@ sub status_card {
my $status = $self->get_user_status( $user->{id} );
my $visibility;
+ my $map_data = {};
if ( $status->{checked_in} or $status->{arr_name} ) {
my $visibility = $status->{effective_visibility};
if (
@@ -579,12 +615,20 @@ sub status_card {
$status->{arr_name} = undef;
}
+ if ( $status->{checked_in} ) {
+ $map_data = $self->journeys_to_map_data(
+ journeys => [$status],
+ with_now_markers => 1,
+ );
+ }
+
$self->render(
'_public_status_card',
name => $name,
privacy => $user,
journey => $status,
from_profile => $self->param('profile') ? 1 : 0,
+ %{$map_data},
);
}