From c5957fbdfdf5a3871e0ae421c7e6042ce580d52d Mon Sep 17 00:00:00 2001 From: Derf Null Date: Fri, 23 Jun 2023 22:43:41 +0200 Subject: User: remove legacy public_level / is_public field --- lib/Travelynx/Controller/Profile.pm | 6 +++--- lib/Travelynx/Model/Users.pm | 8 +++----- templates/_public_status_card.html.ep | 2 +- templates/profile.html.ep | 2 +- templates/user_status.html.ep | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/Travelynx/Controller/Profile.pm b/lib/Travelynx/Controller/Profile.pm index 3923773..ff69c43 100755 --- a/lib/Travelynx/Controller/Profile.pm +++ b/lib/Travelynx/Controller/Profile.pm @@ -183,9 +183,9 @@ sub profile { 'profile', name => $name, uid => $user->{id}, + privacy => $user, bio => $profile->{bio}{html}, metadata => $profile->{metadata}, - public_level => $user->{public_level}, is_self => $is_self, following => ( $relation and $relation eq 'follows' ) ? 1 : 0, follow_requested => ( $relation and $relation eq 'requests_follow' ) @@ -533,7 +533,7 @@ sub user_status { any => { template => 'user_status', name => $name, - public_level => $user->{public_level}, + privacy => $user, journey => $status, journey_visibility => $visibility, twitter => \%tw_data, @@ -615,7 +615,7 @@ sub status_card { $self->render( '_public_status_card', name => $name, - public_level => $user->{public_level}, + privacy => $user, journey => $status, journey_visibility => $visibility, from_profile => $self->param('profile') ? 1 : 0, diff --git a/lib/Travelynx/Model/Users.pm b/lib/Travelynx/Model/Users.pm index ade9711..809273f 100644 --- a/lib/Travelynx/Model/Users.pm +++ b/lib/Travelynx/Model/Users.pm @@ -186,10 +186,9 @@ sub get_privacy_by { if ( my $user = $res->hash ) { return { - id => $user->{id}, - name => $user->{name}, - public_level => $user->{public_level}, # todo remove? - default_visibility => $user->{public_level} & 0x7f, + id => $user->{id}, + name => $user->{name}, + default_visibility => $user->{public_level} & 0x7f, default_visibility_str => $visibility_itoa{ $user->{public_level} & 0x7f }, comments_visible => $user->{public_level} & 0x80 ? 1 : 0, @@ -414,7 +413,6 @@ sub get { notifications => $user->{notifications}, accept_follows => $user->{accept_follows} == 2 ? 1 : 0, accept_follow_requests => $user->{accept_follows} == 1 ? 1 : 0, - is_public => $user->{public_level}, default_visibility => $user->{public_level} & 0x7f, default_visibility_str => $visibility_itoa{ $user->{public_level} & 0x7f }, diff --git a/templates/_public_status_card.html.ep b/templates/_public_status_card.html.ep index 42d507e..65255c5 100644 --- a/templates/_public_status_card.html.ep +++ b/templates/_public_status_card.html.ep @@ -14,7 +14,7 @@ <%= visibility_icon($journey_visibility) %> % } - % if ($public_level & 0x04 and $journey->{comment}) { + % if ($privacy->{comments_visible} and $journey->{comment}) {

„<%= $journey->{comment} %>“

% }

diff --git a/templates/profile.html.ep b/templates/profile.html.ep index 06f8cfe..ed7ff0d 100644 --- a/templates/profile.html.ep +++ b/templates/profile.html.ep @@ -79,7 +79,7 @@

- %= include '_public_status_card', name => $name, public_level => $public_level, journey => $journey, journey_visibility => $journey_visibility, from_profile => 1 + %= include '_public_status_card', name => $name, privacy => $privacy, journey => $journey, journey_visibility => $journey_visibility, from_profile => 1
% if ($journeys and @{$journeys}) { diff --git a/templates/user_status.html.ep b/templates/user_status.html.ep index d67ffb0..97c10ec 100644 --- a/templates/user_status.html.ep +++ b/templates/user_status.html.ep @@ -1,6 +1,6 @@
- %= include '_public_status_card', name => $name, public_level => $public_level, journey => $journey, journey_visibility => $journey_visibility + %= include '_public_status_card', name => $name, privacy => $privacy, journey => $journey, journey_visibility => $journey_visibility
-- cgit v1.2.3