Peer resolution for a contact isn't needed, reference is found in 'address' which could be resolved at a later time

This commit is contained in:
netkas 2025-01-31 13:05:31 -05:00
parent 1f55538ad4
commit 2ba814f9b4
2 changed files with 0 additions and 38 deletions

View file

@ -564,18 +564,8 @@
return null;
}
try
{
$peer = Socialbox::resolvePeer($contactAddress);
}
catch (StandardRpcException $e)
{
$peer = null;
}
return new ContactRecord([
'address' => $contact->getContactPeerAddress(),
'peer' => $peer,
'relationship' => $contact->getRelationship(),
'known_keys' => self::contactGetSigningKeys($contact),
'added_timestamp' => $contact->getCreated()->getTimestamp()

View file

@ -10,7 +10,6 @@
class ContactRecord implements SerializableInterface
{
private PeerAddress $address;
private ?Peer $peer;
private ContactRelationshipType $relationship;
/**
* @var KnownSigningKey[]
@ -26,22 +25,6 @@
public function __construct(array $data)
{
$this->address = PeerAddress::fromAddress($data['address']);
if(is_array($data['peer']))
{
$this->peer = Peer::fromArray($data['peer']);
}
elseif($data['peer'] instanceof Peer)
{
$this->peer = $data['peer'];
}
elseif(is_null($data['peer']))
{
$this->peer = null;
}
else
{
throw new InvalidArgumentException('Invalid peer data');
}
if($data['relationship'] instanceof ContactRelationshipType)
{
@ -86,16 +69,6 @@
return $this->address;
}
/**
* Retrieves the peer of the contact.
*
* @return Peer|null Returns the peer of the contact. If the peer is not known, null is returned.
*/
public function getPeer(): ?Peer
{
return $this->peer;
}
/**
* Retrieves the relationship of the contact.
*
@ -141,7 +114,6 @@
{
return [
'address' => $this->address->getAddress(),
'peer' => $this->peer?->toArray(),
'relationship' => $this->relationship->value,
'known_keys' => array_map(function($key) {return $key->toArray();}, $this->knownKeys),
'added_timestamp' => $this->addedTimestamp