From 8a843eb60b6d7ed2896f0d859a44bad98253ba9f Mon Sep 17 00:00:00 2001 From: netkas Date: Tue, 4 Mar 2025 13:41:36 -0500 Subject: [PATCH] Refactor RegisteredPeerManager to use getPeerAddress() for domain and username retrieval --- src/Socialbox/Managers/RegisteredPeerManager.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Socialbox/Managers/RegisteredPeerManager.php b/src/Socialbox/Managers/RegisteredPeerManager.php index 91622fa..c7cc831 100644 --- a/src/Socialbox/Managers/RegisteredPeerManager.php +++ b/src/Socialbox/Managers/RegisteredPeerManager.php @@ -202,17 +202,17 @@ */ public static function synchronizeExternalPeer(Peer $peer): void { - if($peer->getAddress()->getDomain() === Configuration::getInstanceConfiguration()->getDomain()) + if($peer->getPeerAddress()->getDomain() === Configuration::getInstanceConfiguration()->getDomain()) { throw new InvalidArgumentException('Given peer is not an external peer'); } - if($peer->getAddress()->getUsername() === ReservedUsernames::HOST->value) + if($peer->getPeerAddress()->getUsername() === ReservedUsernames::HOST->value) { throw new InvalidArgumentException('Cannot synchronize an external host peer'); } - $existingPeer = self::getPeerByAddress($peer->getAddress()); + $existingPeer = self::getPeerByAddress($peer->getPeerAddress()); if($existingPeer !== null) { // getUpdated is DateTime() if it's older than 1 hour, update it @@ -263,9 +263,9 @@ { $statement = Database::getConnection()->prepare('INSERT INTO peers (uuid, username, server, enabled) VALUES (:uuid, :username, :server, 1)'); $statement->bindParam(':uuid', $uuid); - $username = $peer->getAddress()->getUsername(); + $username = $peer->getPeerAddress()->getUsername(); $statement->bindParam(':username', $username); - $server = $peer->getAddress()->getDomain(); + $server = $peer->getPeerAddress()->getDomain(); $statement->bindParam(':server', $server); $statement->execute();