kopia lustrzana https://github.com/pixelfed/pixelfed
Update FollowerService, add quickCheck to follows method for non cold-boot checks
rodzic
e5d789e0ab
commit
d3f032b2ec
|
@ -89,12 +89,16 @@ class FollowerService
|
||||||
return Redis::zCard(self::FOLLOWING_KEY . $id);
|
return Redis::zCard(self::FOLLOWING_KEY . $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function follows(string $actor, string $target)
|
public static function follows(string $actor, string $target, $quickCheck = false)
|
||||||
{
|
{
|
||||||
if($actor == $target) {
|
if($actor == $target) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($quickCheck) {
|
||||||
|
return (bool) Redis::zScore(self::FOLLOWERS_KEY . $target, $actor);
|
||||||
|
}
|
||||||
|
|
||||||
if(self::followerCount($target, false) && self::followingCount($actor, false)) {
|
if(self::followerCount($target, false) && self::followingCount($actor, false)) {
|
||||||
self::cacheSyncCheck($target, 'followers');
|
self::cacheSyncCheck($target, 'followers');
|
||||||
return (bool) Redis::zScore(self::FOLLOWERS_KEY . $target, $actor);
|
return (bool) Redis::zScore(self::FOLLOWERS_KEY . $target, $actor);
|
||||||
|
|
Ładowanie…
Reference in New Issue