Refine community guidelines acceptance logic

This commit is contained in:
netkas 2025-01-06 02:14:29 -05:00
parent 480eaa6bc5
commit da250d6189

View file

@ -15,17 +15,21 @@
{
/**
* Executes the process of accepting the community guidelines.
*
* @inheritDoc
*/
public static function execute(ClientRequest $request, RpcRequest $rpcRequest): ?SerializableInterface
{
if(!$request->getSession()->flagExists(SessionFlags::VER_COMMUNITY_GUIDELINES))
{
return $rpcRequest->produceError(StandardError::FORBIDDEN, 'Community guidelines has already been accepted');
}
try
{
// Remove the verification flag
SessionManager::removeFlags($request->getSessionUuid(), [SessionFlags::VER_COMMUNITY_GUIDELINES]);
// Check & update the session flow
SessionManager::updateFlow($request->getSession());
SessionManager::updateFlow($request->getSession(), [SessionFlags::VER_COMMUNITY_GUIDELINES]);
}
catch (DatabaseOperationException $e)
{