/status/:user: respond to JSON

This commit is contained in:
Derf Null 2023-05-21 19:57:56 +02:00
parent dbc5c38968
commit 9b83e1a8f1
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA
2 changed files with 19 additions and 10 deletions

View file

@ -1696,7 +1696,7 @@ sub startup {
'get_user_status_json_v1' => sub {
my ( $self, %opt ) = @_;
my $uid = $opt{uid};
my $status = $self->get_user_status($uid);
my $status = $opt{status} // $self->get_user_status($uid);
my $ret = {
deprecated => \0,

View file

@ -405,15 +405,24 @@ sub user_status {
$og_data{description} = $tw_data{description} = q{};
}
$self->render(
'user_status',
name => $name,
public_level => $user->{public_level},
journey => $status,
journey_visibility => $visibility,
twitter => \%tw_data,
opengraph => \%og_data,
version => $self->app->config->{version} // 'UNKNOWN',
$self->respond_to(
json => {
json => {
name => $name,
status => $self->get_user_status_json_v1( status => $status ),
version => $self->app->config->{version} // 'UNKNOWN',
},
},
any => {
template => 'user_status',
name => $name,
public_level => $user->{public_level},
journey => $status,
journey_visibility => $visibility,
twitter => \%tw_data,
opengraph => \%og_data,
version => $self->app->config->{version} // 'UNKNOWN',
},
);
}