user status: only redirect to journey if journey is visible
This commit is contained in:
parent
09a4f1ce0b
commit
d35c49b55d
1 changed files with 27 additions and 7 deletions
|
@ -519,21 +519,41 @@ sub user_status {
|
||||||
or $status->{sched_departure}->epoch != $ts )
|
or $status->{sched_departure}->epoch != $ts )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
for my $candidate (
|
for my $journey (
|
||||||
$self->journeys->get(
|
$self->journeys->get(
|
||||||
uid => $user->{id},
|
uid => $user->{id},
|
||||||
sched_dep_ts => $ts,
|
sched_dep_ts => $ts,
|
||||||
limit => 1,
|
limit => 1,
|
||||||
|
with_visibility => 1,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
my $token = $self->param('token');
|
my $token = $self->param('token');
|
||||||
if ($token) {
|
if ($token) {
|
||||||
$self->redirect_to(
|
my $visibility = $self->compute_effective_visibility(
|
||||||
"/p/${name}/j/$candidate->{id}?token=${token}-${ts}");
|
$user->{default_visibility_str},
|
||||||
|
$journey->{visibility_str}
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
$visibility eq 'public'
|
||||||
|
or ( $visibility eq 'unlisted'
|
||||||
|
and $self->journey_token_ok( $journey, $ts ) )
|
||||||
|
or (
|
||||||
|
$visibility eq 'travelynx'
|
||||||
|
and ( $self->is_user_authenticated
|
||||||
|
or $self->journey_token_ok( $journey, $ts ) )
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$self->redirect_to(
|
||||||
|
"/p/${name}/j/$journey->{id}?token=${token}-${ts}");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$self->render('not_found');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$self->redirect_to("/p/${name}/j/$candidate->{id}");
|
$self->redirect_to("/p/${name}/j/$journey->{id}");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue