Update addressBookAddContact method to return boolean and adjust response handling
Some checks are pending
CI / release (push) Waiting to run
CI / debug (push) Waiting to run
CI / release_executable (push) Waiting to run
CI / debug_executable (push) Waiting to run
CI / check-phpunit (push) Waiting to run
CI / check-phpdoc (push) Waiting to run
CI / generate-phpdoc (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / release-documentation (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
Some checks are pending
CI / release (push) Waiting to run
CI / debug (push) Waiting to run
CI / release_executable (push) Waiting to run
CI / debug_executable (push) Waiting to run
CI / check-phpunit (push) Waiting to run
CI / check-phpdoc (push) Waiting to run
CI / generate-phpdoc (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / release-documentation (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
This commit is contained in:
parent
4f9cc89cb8
commit
42168b132d
2 changed files with 5 additions and 5 deletions
|
@ -65,11 +65,11 @@
|
||||||
// Check if the contact already exists
|
// Check if the contact already exists
|
||||||
if(ContactManager::isContact($peer, $peerAddress))
|
if(ContactManager::isContact($peer, $peerAddress))
|
||||||
{
|
{
|
||||||
return $rpcRequest->produceError(StandardError::FORBIDDEN, 'Contact already exists');
|
return $rpcRequest->produceResponse(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the contact
|
// Create the contact
|
||||||
$contactUuid = ContactManager::createContact($peer, $peerAddress, $relationship);
|
ContactManager::createContact($peer, $peerAddress, $relationship);
|
||||||
}
|
}
|
||||||
catch (DatabaseOperationException $e)
|
catch (DatabaseOperationException $e)
|
||||||
{
|
{
|
||||||
|
@ -77,6 +77,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return success
|
// Return success
|
||||||
return $rpcRequest->produceResponse($contactUuid);
|
return $rpcRequest->produceResponse(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -194,10 +194,10 @@
|
||||||
*
|
*
|
||||||
* @param PeerAddress|string $peer The address of the peer to add as a contact
|
* @param PeerAddress|string $peer The address of the peer to add as a contact
|
||||||
* @param string|ContactRelationshipType|null $relationship Optional. The relationship for the peer
|
* @param string|ContactRelationshipType|null $relationship Optional. The relationship for the peer
|
||||||
* @return string Returns the contact uuid if the contact was created, False if it already exists
|
* @return bool Returns the contact uuid if the contact was created, False if it already exists
|
||||||
* @throws RpcException Thrown if there was an error with the RPC request
|
* @throws RpcException Thrown if there was an error with the RPC request
|
||||||
*/
|
*/
|
||||||
public function addressBookAddContact(PeerAddress|string $peer, null|string|ContactRelationshipType $relationship=ContactRelationshipType::MUTUAL): string
|
public function addressBookAddContact(PeerAddress|string $peer, null|string|ContactRelationshipType $relationship=ContactRelationshipType::MUTUAL): bool
|
||||||
{
|
{
|
||||||
if($peer instanceof PeerAddress)
|
if($peer instanceof PeerAddress)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue