From b44b770ec3eb820699bad44600c78edb5f4aac9e Mon Sep 17 00:00:00 2001 From: Derf Null Date: Sat, 24 Jun 2023 21:25:14 +0200 Subject: fine-graned visibility selection of history / past checkins most notably, adds a 'history for followers only' mode --- lib/Travelynx/Model/Users.pm | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'lib/Travelynx/Model') diff --git a/lib/Travelynx/Model/Users.pm b/lib/Travelynx/Model/Users.pm index 1747989..95cab8f 100644 --- a/lib/Travelynx/Model/Users.pm +++ b/lib/Travelynx/Model/Users.pm @@ -191,12 +191,14 @@ sub get_privacy_by { default_visibility => $user->{public_level} & 0x7f, default_visibility_str => $visibility_itoa{ $user->{public_level} & 0x7f }, - comments_visible => $user->{public_level} & 0x80 ? 1 : 0, - past_visible => ( $user->{public_level} & 0x300 ) >> 8, - past_all => $user->{public_level} & 0x400 ? 1 : 0, - past_status => $user->{public_level} & 0x800 ? 1 : 0, - accept_follows => $user->{accept_follows} == 2 ? 1 : 0, - accept_follow_requests => $user->{accept_follows} == 1 ? 1 : 0, + comments_visible => $user->{public_level} & 0x80 ? 1 : 0, + past_visibility => ( $user->{public_level} & 0x7f00 ) >> 8, + past_visibility_str => + $visibility_itoa{ ( $user->{public_level} & 0x7f00 ) >> 8 }, + past_status => $user->{public_level} & 0x08000 ? 1 : 0, + past_all => $user->{public_level} & 0x10000 ? 1 : 0, + accept_follows => $user->{accept_follows} == 2 ? 1 : 0, + accept_follow_requests => $user->{accept_follows} == 1 ? 1 : 0, }; } return; @@ -211,9 +213,10 @@ sub set_privacy { if ( not defined $public_level and defined $opt{default_visibility} ) { $public_level = ( $opt{default_visibility} & 0x7f ) - | ( $opt{comments_visible} ? 0x80 : 0x00 ) - | ( ( ( $opt{past_visible} // 0 ) << 8 ) & 0x300 ) - | ( $opt{past_all} ? 0x400 : 0 ) | ( $opt{past_status} ? 0x800 : 0 ); + | ( $opt{comments_visible} ? 0x80 : 0 ) + | ( ( $opt{past_visibility} & 0x7f ) << 8 ) + | ( $opt{past_status} ? 0x08000 : 0 ) + | ( $opt{past_all} ? 0x10000 : 0 ); } $db->update( 'users', { public_level => $public_level }, { id => $uid } ); @@ -416,12 +419,14 @@ sub get { default_visibility => $user->{public_level} & 0x7f, default_visibility_str => $visibility_itoa{ $user->{public_level} & 0x7f }, - comments_visible => $user->{public_level} & 0x80 ? 1 : 0, - past_visible => ( $user->{public_level} & 0x300 ) >> 8, - past_all => $user->{public_level} & 0x400 ? 1 : 0, - past_status => $user->{public_level} & 0x800 ? 1 : 0, - email => $user->{email}, - sb_name => $user->{external_services} + comments_visible => $user->{public_level} & 0x80 ? 1 : 0, + past_visibility => ( $user->{public_level} & 0x7f00 ) >> 8, + past_visibility_str => + $visibility_itoa{ ( $user->{public_level} & 0x7f00 ) >> 8 }, + past_status => $user->{public_level} & 0x08000 ? 1 : 0, + past_all => $user->{public_level} & 0x10000 ? 1 : 0, + email => $user->{email}, + sb_name => $user->{external_services} ? $sb_templates[ $user->{external_services} & 0x07 ][0] : undef, sb_template => $user->{external_services} -- cgit v1.2.3