|
|
|
@ -6,6 +6,7 @@ use Auth;
|
|
|
|
|
use Cache;
|
|
|
|
|
use App\Profile;
|
|
|
|
|
use App\User;
|
|
|
|
|
use App\UserSetting;
|
|
|
|
|
use League\Fractal;
|
|
|
|
|
use App\Services\PronounService;
|
|
|
|
|
|
|
|
|
@ -26,6 +27,25 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$local = $profile->private_key != null;
|
|
|
|
|
$local = $profile->user_id && $profile->private_key != null;
|
|
|
|
|
$hideFollowing = false;
|
|
|
|
|
$hideFollowers = false;
|
|
|
|
|
if($local) {
|
|
|
|
|
$hideFollowing = Cache::remember('pf:acct-trans:hideFollowing:' . $profile->id, 2592000, function() use($profile) {
|
|
|
|
|
$settings = UserSetting::whereUserId($profile->user_id)->first();
|
|
|
|
|
if(!$settings) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return $settings->show_profile_following_count == false;
|
|
|
|
|
});
|
|
|
|
|
$hideFollowers = Cache::remember('pf:acct-trans:hideFollowers:' . $profile->id, 2592000, function() use($profile) {
|
|
|
|
|
$settings = UserSetting::whereUserId($profile->user_id)->first();
|
|
|
|
|
if(!$settings) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return $settings->show_profile_follower_count == false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
$is_admin = !$local ? false : in_array($profile->id, $adminIds);
|
|
|
|
|
$acct = $local ? $profile->username : substr($profile->username, 1);
|
|
|
|
|
$username = $local ? $profile->username : explode('@', $acct)[0];
|
|
|
|
@ -36,8 +56,8 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|
|
|
|
'display_name' => $profile->name,
|
|
|
|
|
'discoverable' => true,
|
|
|
|
|
'locked' => (bool) $profile->is_private,
|
|
|
|
|
'followers_count' => (int) $profile->followers_count,
|
|
|
|
|
'following_count' => (int) $profile->following_count,
|
|
|
|
|
'followers_count' => $hideFollowers ? 0 : (int) $profile->followers_count,
|
|
|
|
|
'following_count' => $hideFollowing ? 0 : (int) $profile->following_count,
|
|
|
|
|
'statuses_count' => (int) $profile->status_count,
|
|
|
|
|
'note' => $profile->bio ?? '',
|
|
|
|
|
'note_text' => $profile->bio ? strip_tags($profile->bio) : null,
|
|
|
|
|