. * */ namespace Friendica\Worker\Contact; use Friendica\Core\Protocol; use Friendica\Core\Worker; use Friendica\Model\Contact; use Friendica\Model\User; class Unfollow { /** * Issue asynchronous unfollow message to remote servers. * The local relationship has already been updated, so we can't use the user-specific contact. * * @param int $cid Target public contact (uid = 0) id * @param int $uid Source local user id * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ public static function execute(int $cid, int $uid) { $contact = Contact::getById($cid); if (empty($contact)) { return; } $owner = User::getOwnerDataById($uid, false); if (empty($owner)) { return; } $result = Protocol::unfollow($contact, $owner); if ($result === false) { Worker::defer(); } } }