Skip to content

Commit 1664a5b

Browse files
committed
Update FollowerService, add $silent param to remove method to more efficently purge relationships
1 parent a492a95 commit 1664a5b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app/Services/FollowerService.php

+9-7
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,18 @@ public static function add($actor, $target, $refresh = true)
3535
Cache::forget('profile:following:' . $actor);
3636
}
3737

38-
public static function remove($actor, $target)
38+
public static function remove($actor, $target, $silent = false)
3939
{
4040
Redis::zrem(self::FOLLOWING_KEY . $actor, $target);
4141
Redis::zrem(self::FOLLOWERS_KEY . $target, $actor);
42-
Cache::forget('pf:services:follower:audience:' . $actor);
43-
Cache::forget('pf:services:follower:audience:' . $target);
44-
AccountService::del($actor);
45-
AccountService::del($target);
46-
RelationshipService::refresh($actor, $target);
47-
Cache::forget('profile:following:' . $actor);
42+
if($silent !== true) {
43+
AccountService::del($actor);
44+
AccountService::del($target);
45+
RelationshipService::refresh($actor, $target);
46+
Cache::forget('profile:following:' . $actor);
47+
} else {
48+
RelationshipService::forget($actor, $target);
49+
}
4850
}
4951

5052
public static function followers($id, $start = 0, $stop = 10)

0 commit comments

Comments
 (0)