diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-05-29 20:01:52 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-05-29 20:01:52 +0200 |
commit | 155f9f39cc83fcf83e5dd48ae58b09736281c912 (patch) | |
tree | 6d181034a0f0599b9c5929e5db31d2f25435281c /lib/Travelynx/Controller | |
parent | 146b3a2682c7c91984b15bfa34325558201203ba (diff) |
use journey-specific status links -> one twitter card per journey
Diffstat (limited to 'lib/Travelynx/Controller')
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index de79728..59991a8 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -29,6 +29,7 @@ sub user_status { my ($self) = @_; my $name = $self->stash('name'); + my $ts = $self->stash('ts'); my $user = $self->get_privacy_by_name($name); if ( $user and ( $user->{public_level} & 0x02 ) ) { @@ -41,7 +42,16 @@ sub user_status { ->to_abs->scheme('https'), ); - if ( $status->{checked_in} ) { + if ( + $ts + and ( not $status->{checked_in} + or $status->{sched_departure}->epoch != $ts ) + ) + { + $tw_data{title} = "Bahnfahrt beendet"; + $tw_data{description} = "${name} hat das Ziel erreicht"; + } + elsif ( $status->{checked_in} ) { $tw_data{title} = "${name} ist unterwegs"; $tw_data{description} = sprintf( '%s %s von %s nach %s', @@ -53,7 +63,6 @@ sub user_status { if ( $status->{real_arrival}->epoch ) { $tw_data{description} .= $status->{real_arrival} ->strftime(' – Ankunft gegen %H:%M Uhr'); - } } else { |