diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm
index 10200a6..c68a22c 100644
--- a/lib/Travelynx/Controller/Account.pm
+++ b/lib/Travelynx/Controller/Account.pm
@@ -261,6 +261,13 @@ sub privacy {
$public_level &= ~0x30;
}
+ if ( $self->param('history_age') eq 'infinite' ) {
+ $public_level |= 0x40;
+ }
+ else {
+ $public_level &= ~0x40;
+ }
+
$self->users->set_privacy(
uid => $user->{id},
level => $public_level
@@ -281,6 +288,8 @@ sub privacy {
: $public_level & 0x20 ? 'extern'
: 'private'
);
+ $self->param(
+ history_age => $public_level & 0x40 ? 'infinite' : 'month' );
$self->render( 'privacy', name => $user->{name} );
}
}
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 33b3118..24edaa3 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -160,12 +160,32 @@ sub public_profile {
)
{
my $status = $self->get_user_status( $user->{id} );
+ my @journeys;
+ if ( $user->{public_level} & 0x40 ) {
+ @journeys = $self->journeys->get(
+ uid => $user->{id},
+ limit => 10,
+ with_datetime => 1
+ );
+ }
+ else {
+ my $now = DateTime->now( time_zone => 'Europe/Berlin' );
+ my $month_ago = $now->clone->subtract( weeks => 4 );
+ @journeys = $self->journeys->get(
+ uid => $user->{id},
+ limit => 10,
+ with_datetime => 1,
+ after => $month_ago,
+ before => $now
+ );
+ }
$self->render(
'profile',
name => $name,
uid => $user->{id},
public_level => $user->{public_level},
journey => $status,
+ journeys => [@journeys],
version => $self->app->config->{version} // 'UNKNOWN',
);
}
@@ -207,12 +227,22 @@ sub public_journey_details {
with_polyline => 1,
);
+ if ( not( $user->{public_level} & 0x40 ) ) {
+ my $month_ago = DateTime->now( time_zone => 'Europe/Berlin' )
+ ->subtract( weeks => 4 )->epoch;
+ if ( $journey and $journey->{rt_dep_ts} < $month_ago ) {
+ $journey = undef;
+ }
+ }
+
if ($journey) {
my $map_data = $self->journeys_to_map_data(
journeys => [$journey],
include_manual => 1,
);
- if ( $journey->{user_data}{comment} ) {
+ if ( $journey->{user_data}{comment}
+ and not $user->{public_level} & 0x04 )
+ {
delete $journey->{user_data}{comment};
}
$self->render(
@@ -226,7 +256,7 @@ sub public_journey_details {
);
}
else {
- $self->render( 'not_found', );
+ $self->render('not_found');
}
}
else {
diff --git a/templates/account.html.ep b/templates/account.html.ep
index 7bc725f..9b049a3 100644
--- a/templates/account.html.ep
+++ b/templates/account.html.ep
@@ -72,17 +72,23 @@
% elsif ($acc->{is_public} & 0x02) {
Aktueller Status
% }
- % if ($acc->{is_public} & 0x04) {
- mit Kommentar
- % }
% if ($acc->{is_public} & 0x0f and $acc->{is_public} & 0xf0) {
% }
- % if ($acc->{is_public} & 0x10) {
- Vergangene Fahrten (nur mit Anmeldung)
+ % if ($acc->{is_public} & 0x30) {
+ % if ($acc->{is_public} & 0x40) {
+ Vergangene Fahrten
+ % }
+ % else {
+ Fahrten der letzten vier Wochen
+ % }
+ % if ($acc->{is_public} & 0x10) {
+ (nur mit Anmeldung)
+ % }
% }
- % elsif ($acc->{is_public} & 0x20) {
- Vergangene Fahrten
+ % if ($acc->{is_public} & 0x04) {
+
+ Kommentare
% }
diff --git a/templates/privacy.html.ep b/templates/privacy.html.ep
index 98dc068..b5f3bb3 100644
--- a/templates/privacy.html.ep
+++ b/templates/privacy.html.ep
@@ -12,26 +12,22 @@