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

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