diff options
Diffstat (limited to 'lib/Travelynx/Controller')
-rw-r--r-- | lib/Travelynx/Controller/Account.pm | 22 | ||||
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 38 |
2 files changed, 60 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm index e4b385c..44babfa 100644 --- a/lib/Travelynx/Controller/Account.pm +++ b/lib/Travelynx/Controller/Account.pm @@ -208,6 +208,28 @@ sub do_logout { $self->redirect_to('/login'); } +sub privacy { + my ($self) = @_; + + my $user = $self->current_user; + my $public_level = $user->{is_public}; + + if ( $self->param('action') and $self->param('action') eq 'save' ) { + if ( $self->param('public_status') ) { + $public_level |= 0x02; + } + else { + $public_level &= ~0x02; + } + $self->set_privacy( $user->{id}, $public_level ); + } + else { + $self->param( public_status => $public_level & 0x02 ? 1 : 0 ); + } + + $self->render( 'privacy', name => $user->{name} ); +} + sub change_mail { my ($self) = @_; diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 81b3a70..cf704ec 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -25,6 +25,44 @@ sub homepage { } } +sub user_status { + my ($self) = @_; + + my $name = $self->stash('name'); + my $user = $self->get_privacy_by_name($name); + + if ( $user and ( $user->{public_level} & 0x02 ) ) { + my $status = $self->get_user_status( $user->{id} ); + $self->render( + 'user_status', + name => $name, + journey => $status + ); + } + else { + $self->render('not_found'); + } +} + +sub public_status_card { + my ($self) = @_; + + my $name = $self->stash('name'); + my $user = $self->get_privacy_by_name($name); + + if ( $user and ( $user->{public_level} & 0x02 ) ) { + my $status = $self->get_user_status( $user->{id} ); + $self->render( + '_public_status_card', + name => $name, + journey => $status + ); + } + else { + $self->render('not_found'); + } +} + sub status_card { my ($self) = @_; my $status = $self->get_user_status; |