mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update AccountService, add getMastodon method for mastoapi compatibility
This commit is contained in:
parent
6667f4f1d7
commit
85e4be8172
3 changed files with 33 additions and 4 deletions
|
@ -33,6 +33,35 @@ class AccountService
|
|||
});
|
||||
}
|
||||
|
||||
public static function getMastodon($id, $softFail = false)
|
||||
{
|
||||
$account = self::get($id, $softFail);
|
||||
if(!$account) {
|
||||
return null;
|
||||
}
|
||||
|
||||
unset(
|
||||
$account['header_bg'],
|
||||
$account['is_admin'],
|
||||
$account['last_fetched_at'],
|
||||
$account['local'],
|
||||
$account['location'],
|
||||
$account['note_text'],
|
||||
$account['pronouns'],
|
||||
$account['website']
|
||||
);
|
||||
|
||||
$account['avatar_static'] = $account['avatar'];
|
||||
$account['bot'] = false;
|
||||
$account['emojis'] = [];
|
||||
$account['fields'] = [];
|
||||
$account['header'] = url('/storage/headers/missing.png');
|
||||
$account['header_static'] = url('/storage/headers/missing.png');
|
||||
$account['last_status_at'] = null;
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
public static function del($id)
|
||||
{
|
||||
return Cache::forget(self::CACHE_KEY . $id);
|
||||
|
|
|
@ -25,8 +25,8 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|||
'acct' => $acct,
|
||||
'display_name' => $profile->name,
|
||||
'locked' => (bool) $profile->is_private,
|
||||
'followers_count' => $profile->followerCount(),
|
||||
'following_count' => $profile->followingCount(),
|
||||
'followers_count' => (int) $profile->followerCount(),
|
||||
'following_count' => (int) $profile->followingCount(),
|
||||
'statuses_count' => (int) $profile->statusCount(),
|
||||
'note' => $profile->bio ?? '',
|
||||
'note_text' => strip_tags($profile->bio),
|
||||
|
|
|
@ -24,8 +24,8 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|||
'url' => $profile->url(),
|
||||
'avatar' => $profile->avatarUrl(),
|
||||
'avatar_static' => $profile->avatarUrl(),
|
||||
'header' => '',
|
||||
'header_static' => '',
|
||||
'header' => url('/storage/headers/missing.png'),
|
||||
'header_static' => url('/storage/headers/missing.png'),
|
||||
'followers_count' => (int) $profile->followerCount(),
|
||||
'following_count' => (int) $profile->followingCount(),
|
||||
'statuses_count' => (int) $profile->statusCount(),
|
||||
|
|
Loading…
Reference in a new issue