Improved return logic

This commit is contained in:
netkas 2025-01-31 13:39:32 -05:00
parent 4c28112e3b
commit aa70a83c26

View file

@ -37,7 +37,7 @@
{ {
if(!PeerInformationManager::fieldExists($request->getPeer(), $fieldName)) if(!PeerInformationManager::fieldExists($request->getPeer(), $fieldName))
{ {
return $rpcRequest->produceError(StandardError::FORBIDDEN, 'The information field does not exist'); return $rpcRequest->produceResponse(false);
} }
} }
catch(DatabaseOperationException $e) catch(DatabaseOperationException $e)
@ -45,6 +45,7 @@
throw new StandardRpcException('Failed to check if the information field exists', StandardError::INTERNAL_SERVER_ERROR, $e); throw new StandardRpcException('Failed to check if the information field exists', StandardError::INTERNAL_SERVER_ERROR, $e);
} }
// Prevent the removal of required fields
switch($fieldName) switch($fieldName)
{ {
case InformationFieldName::DISPLAY_NAME: case InformationFieldName::DISPLAY_NAME: