use journey-specific status links -> one twitter card per journey
This commit is contained in:
parent
146b3a2682
commit
155f9f39cc
3 changed files with 14 additions and 3 deletions
|
@ -2177,7 +2177,9 @@ sub startup {
|
|||
$r->get('/register')->to('account#registration_form');
|
||||
$r->get('/reg/:id/:token')->to('account#verify');
|
||||
$r->get('/status/:name')->to('traveling#user_status');
|
||||
$r->get('/status/:name/:ts')->to('traveling#user_status');
|
||||
$r->get('/ajax/status/:name')->to('traveling#public_status_card');
|
||||
$r->get('/ajax/status/:name/:ts')->to('traveling#public_status_card');
|
||||
$r->post('/action')->to('traveling#log_action');
|
||||
$r->post('/geolocation')->to('traveling#geolocation');
|
||||
$r->post('/list_departures')->to('traveling#redirect_to_station');
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
<a class="action-share blue-text right"
|
||||
data-text="Ich bin gerade <%= $attrib %> <%= $journey->{train_type} %> <%= $journey->{train_no} %> nach <%= $journey->{arr_name} %> #NowTräwelling #dbl"
|
||||
% if (current_user()->{is_public} & 0x02) {
|
||||
data-url="<%= url_for('/status')->to_abs->scheme('https') %>/<%= current_user->{name} %>"
|
||||
data-url="<%= url_for('/status')->to_abs->scheme('https') %>/<%= current_user->{name} %>/<%= $journey->{sched_departure}->epoch %>"
|
||||
% }
|
||||
>
|
||||
<i class="material-icons left">share</i> Teilen
|
||||
|
|
Loading…
Reference in a new issue