fix ajax refresh of public status card (trim .html suffix)
This commit is contained in:
parent
209e291821
commit
01aec7e977
2 changed files with 19 additions and 14 deletions
|
@ -2520,7 +2520,7 @@ sub startup {
|
||||||
$r->get('/reg/:id/:token')->to('account#verify');
|
$r->get('/reg/:id/:token')->to('account#verify');
|
||||||
$r->get('/status/:name')->to('traveling#user_status');
|
$r->get('/status/:name')->to('traveling#user_status');
|
||||||
$r->get('/status/:name/:ts')->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')->to('traveling#public_status_card');
|
||||||
$r->get('/ajax/status/:name/:ts')->to('traveling#public_status_card');
|
$r->get('/ajax/status/:name/:ts')->to('traveling#public_status_card');
|
||||||
$r->get('/p/:name')->to('traveling#public_profile');
|
$r->get('/p/:name')->to('traveling#public_profile');
|
||||||
$r->get('/p/:name/j/:id')->to('traveling#public_journey_details');
|
$r->get('/p/:name/j/:id')->to('traveling#public_journey_details');
|
||||||
|
|
|
@ -58,9 +58,10 @@ sub user_status {
|
||||||
$ts
|
$ts
|
||||||
and ( not $status->{checked_in}
|
and ( not $status->{checked_in}
|
||||||
or $status->{sched_departure}->epoch != $ts )
|
or $status->{sched_departure}->epoch != $ts )
|
||||||
and ( $user->{public_level} & 0x20
|
and (
|
||||||
or
|
$user->{public_level} & 0x20
|
||||||
( $user->{public_level} & 0x10 and $self->is_user_authenticated ) )
|
or ( $user->{public_level} & 0x10 and $self->is_user_authenticated )
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
for my $candidate (
|
for my $candidate (
|
||||||
|
@ -173,9 +174,10 @@ sub public_profile {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$user
|
$user
|
||||||
and ( $user->{public_level} & 0x22
|
and (
|
||||||
or
|
$user->{public_level} & 0x22
|
||||||
( $user->{public_level} & 0x11 and $self->is_user_authenticated ) )
|
or ( $user->{public_level} & 0x11 and $self->is_user_authenticated )
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
my $status = $self->get_user_status( $user->{id} );
|
my $status = $self->get_user_status( $user->{id} );
|
||||||
|
@ -233,9 +235,10 @@ sub public_journey_details {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$user
|
$user
|
||||||
and ( $user->{public_level} & 0x20
|
and (
|
||||||
or
|
$user->{public_level} & 0x20
|
||||||
( $user->{public_level} & 0x10 and $self->is_user_authenticated ) )
|
or ( $user->{public_level} & 0x10 and $self->is_user_authenticated )
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
my $journey = $self->journeys->get_single(
|
my $journey = $self->journeys->get_single(
|
||||||
|
@ -312,15 +315,17 @@ sub public_status_card {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my $name = $self->stash('name');
|
my $name = $self->stash('name');
|
||||||
|
$name =~ s{[.]html$}{};
|
||||||
my $user = $self->users->get_privacy_by_name( name => $name );
|
my $user = $self->users->get_privacy_by_name( name => $name );
|
||||||
|
|
||||||
delete $self->stash->{layout};
|
delete $self->stash->{layout};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$user
|
$user
|
||||||
and ( $user->{public_level} & 0x02
|
and (
|
||||||
or
|
$user->{public_level} & 0x02
|
||||||
( $user->{public_level} & 0x01 and $self->is_user_authenticated ) )
|
or ( $user->{public_level} & 0x01 and $self->is_user_authenticated )
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
my $status = $self->get_user_status( $user->{id} );
|
my $status = $self->get_user_status( $user->{id} );
|
||||||
|
|
Loading…
Reference in a new issue