get_user_status_json_v1: expose visibility

This commit is contained in:
Derf Null 2023-05-24 21:41:51 +02:00
parent ac816c09b2
commit 7580497cea
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA
2 changed files with 15 additions and 3 deletions

View file

@ -1696,6 +1696,8 @@ sub startup {
'get_user_status_json_v1' => sub {
my ( $self, %opt ) = @_;
my $uid = $opt{uid};
my $privacy = $opt{privacy}
// $self->users->get_privacy_by( uid => $uid );
my $status = $opt{status} // $self->get_user_status($uid);
my $ret = {
@ -1737,6 +1739,15 @@ sub startup {
id => $status->{train_id},
},
intermediateStops => [],
visibility => {
level => $status->{visibility}
// $privacy->{default_visibility},
desc => (
$status->{visibility_str} eq 'default'
? $privacy->{default_visibility_str}
: $status->{visibility_str}
),
}
};
if ( not $opt{public} ) {

View file

@ -411,6 +411,7 @@ sub user_status {
name => $name,
status => $self->get_user_status_json_v1(
status => $status,
privacy => $user,
public => 1
),
version => $self->app->config->{version} // 'UNKNOWN',