Fix Ajax batch controller response format (_success not success)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-01-08 19:51:25 +00:00
parent fb9c96ae61
commit ee709ae86d
2 changed files with 11 additions and 11 deletions

View File

@@ -53,4 +53,4 @@ GATEKEEPER_SUBTITLE="This is a restricted development preview site. Please enter
SSR_FPC_ENABLED=true SSR_FPC_ENABLED=true
LOG_BROWSER_ERRORS=false LOG_BROWSER_ERRORS=false
AJAX_DISABLE_BATCHING=true AJAX_DISABLE_BATCHING=false

View File

@@ -20,8 +20,8 @@ use App\RSpade\Core\Controller\Rsx_Controller_Abstract;
* *
* Response format: * Response format:
* { * {
* "C_0": {success: true, _ajax_return_value: {...}}, * "C_0": {_success: true, _ajax_return_value: {...}},
* "C_1": {success: false, error_type: "...", reason: "..."}, * "C_1": {_success: false, error_type: "...", reason: "..."},
* ... * ...
* } * }
* *
@@ -72,7 +72,7 @@ class Ajax_Batch_Controller extends Rsx_Controller_Abstract
if ($call_id === null || !$controller || !$action) { if ($call_id === null || !$controller || !$action) {
$responses["C_{$call_id}"] = [ $responses["C_{$call_id}"] = [
'success' => false, '_success' => false,
'error_type' => 'invalid_call', 'error_type' => 'invalid_call',
'reason' => 'Missing required fields: call_id, controller, or action', 'reason' => 'Missing required fields: call_id, controller, or action',
]; ];
@@ -83,9 +83,9 @@ class Ajax_Batch_Controller extends Rsx_Controller_Abstract
// Make the Ajax call using Ajax::internal() // Make the Ajax call using Ajax::internal()
$result = Ajax::internal($controller, $action, $call_params); $result = Ajax::internal($controller, $action, $call_params);
// Build success response // Build success response (must use _success to match non-batched format)
$response = [ $response = [
'success' => true, '_success' => true,
'_ajax_return_value' => $result, '_ajax_return_value' => $result,
]; ];
@@ -99,7 +99,7 @@ class Ajax_Batch_Controller extends Rsx_Controller_Abstract
} catch (Exceptions\AjaxAuthRequiredException $e) { } catch (Exceptions\AjaxAuthRequiredException $e) {
$responses["C_{$call_id}"] = [ $responses["C_{$call_id}"] = [
'success' => false, '_success' => false,
'error_code' => Ajax::ERROR_AUTH_REQUIRED, 'error_code' => Ajax::ERROR_AUTH_REQUIRED,
'reason' => $e->getMessage(), 'reason' => $e->getMessage(),
'metadata' => [], 'metadata' => [],
@@ -107,7 +107,7 @@ class Ajax_Batch_Controller extends Rsx_Controller_Abstract
} catch (Exceptions\AjaxUnauthorizedException $e) { } catch (Exceptions\AjaxUnauthorizedException $e) {
$responses["C_{$call_id}"] = [ $responses["C_{$call_id}"] = [
'success' => false, '_success' => false,
'error_code' => Ajax::ERROR_UNAUTHORIZED, 'error_code' => Ajax::ERROR_UNAUTHORIZED,
'reason' => $e->getMessage(), 'reason' => $e->getMessage(),
'metadata' => [], 'metadata' => [],
@@ -115,7 +115,7 @@ class Ajax_Batch_Controller extends Rsx_Controller_Abstract
} catch (Exceptions\AjaxFormErrorException $e) { } catch (Exceptions\AjaxFormErrorException $e) {
$responses["C_{$call_id}"] = [ $responses["C_{$call_id}"] = [
'success' => false, '_success' => false,
'error_code' => Ajax::ERROR_VALIDATION, 'error_code' => Ajax::ERROR_VALIDATION,
'reason' => $e->getMessage(), 'reason' => $e->getMessage(),
'metadata' => $e->get_details(), 'metadata' => $e->get_details(),
@@ -123,7 +123,7 @@ class Ajax_Batch_Controller extends Rsx_Controller_Abstract
} catch (Exceptions\AjaxFatalErrorException $e) { } catch (Exceptions\AjaxFatalErrorException $e) {
$responses["C_{$call_id}"] = [ $responses["C_{$call_id}"] = [
'success' => false, '_success' => false,
'error_code' => Ajax::ERROR_FATAL, 'error_code' => Ajax::ERROR_FATAL,
'reason' => $e->getMessage(), 'reason' => $e->getMessage(),
'metadata' => [], 'metadata' => [],
@@ -132,7 +132,7 @@ class Ajax_Batch_Controller extends Rsx_Controller_Abstract
} catch (\Exception $e) { } catch (\Exception $e) {
// Generic exception handler // Generic exception handler
$responses["C_{$call_id}"] = [ $responses["C_{$call_id}"] = [
'success' => false, '_success' => false,
'error_type' => 'exception', 'error_type' => 'exception',
'reason' => $e->getMessage(), 'reason' => $e->getMessage(),
]; ];