forked from mirror/pixelfed
Update FollowerService
This commit is contained in:
parent
1c59933c0a
commit
ad2db4aea7
|
@ -49,14 +49,28 @@ class FollowerService
|
||||||
return (new self)->getAudienceInboxes($profile);
|
return (new self)->getAudienceInboxes($profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getAudienceInboxes($profile, $scope = null)
|
public static function softwareAudience($profile, $software = 'pixelfed')
|
||||||
{
|
{
|
||||||
if(!$profile instanceOf Profile) {
|
return collect(self::audience($profile))
|
||||||
return [];
|
->filter(function($inbox) use($software) {
|
||||||
|
$domain = parse_url($inbox, PHP_URL_HOST);
|
||||||
|
if(!$domain) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return InstanceService::software($domain) === strtolower($software);
|
||||||
|
})
|
||||||
|
->unique()
|
||||||
|
->values();
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = 'pf:services:follow:audience:' . $profile->id;
|
protected function getAudienceInboxes($pid, $scope = null)
|
||||||
return Cache::remember($key, 86400, function() use($profile) {
|
{
|
||||||
|
$key = 'pf:services:follow:audience:' . $pid;
|
||||||
|
return Cache::remember($key, 86400, function() use($pid) {
|
||||||
|
$profile = Profile::find($pid);
|
||||||
|
if(!$profile) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
return $profile
|
return $profile
|
||||||
->followers()
|
->followers()
|
||||||
->whereLocalProfile(false)
|
->whereLocalProfile(false)
|
||||||
|
|
Loading…
Reference in New Issue