mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Update AccountService
This commit is contained in:
parent
08246f2482
commit
a578035bbc
1 changed files with 41 additions and 0 deletions
|
@ -5,6 +5,7 @@ namespace App\Services;
|
||||||
use Cache;
|
use Cache;
|
||||||
use App\Profile;
|
use App\Profile;
|
||||||
use App\Status;
|
use App\Status;
|
||||||
|
use App\User;
|
||||||
use App\UserSetting;
|
use App\UserSetting;
|
||||||
use App\Transformer\Api\AccountTransformer;
|
use App\Transformer\Api\AccountTransformer;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
|
@ -174,4 +175,44 @@ class AccountService
|
||||||
return (string) $profile->id;
|
return (string) $profile->id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function hiddenFollowers($id)
|
||||||
|
{
|
||||||
|
$account = self::get($id, true);
|
||||||
|
if(!$account || !isset($account['local']) || $account['local'] == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Cache::remember('pf:acct:settings:hidden-followers:' . $id, 43200, function() use($id) {
|
||||||
|
$user = User::whereProfileId($id)->first();
|
||||||
|
if(!$user) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$settings = UserSetting::whereUserId($user->id)->first();
|
||||||
|
if($settings) {
|
||||||
|
return $settings->show_profile_follower_count == false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function hiddenFollowing($id)
|
||||||
|
{
|
||||||
|
$account = self::get($id, true);
|
||||||
|
if(!$account || !isset($account['local']) || $account['local'] == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Cache::remember('pf:acct:settings:hidden-following:' . $id, 43200, function() use($id) {
|
||||||
|
$user = User::whereProfileId($id)->first();
|
||||||
|
if(!$user) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$settings = UserSetting::whereUserId($user->id)->first();
|
||||||
|
if($settings) {
|
||||||
|
return $settings->show_profile_following_count == false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue