From 0578125f7065363f89e1dbfc5ba99b1d11600b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Wed, 23 Jul 2025 13:25:32 +0000 Subject: [PATCH] Fix FLEXIAPI-363 Send the Redis publish event when the externalAccount is... --- CHANGELOG.md | 1 + .../Controllers/Admin/ExternalAccountController.php | 7 ++----- .../Api/Admin/ExternalAccountController.php | 3 +-- flexiapi/app/Services/AccountService.php | 11 +++++++++++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59c62fb..bab20e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ v2.0 - Fix FLEXIAPI-360 Add rules on some jobs to only run them in the Gitlab pipeline when needed - Fix FLEXIAPI-362 Return an empty object and not an empty array in the vcards-storage index endpoint to prevent some parsing issues in the clients - Fix FLEXIAPI-312 Add Redis publish event when updating the externalAccount to ping the Flexisip B2BUA +- Fix FLEXIAPI-363 Send the Redis publish event when the externalAccount is deleted to ping the Flexisip B2BUA v1.6 ---- diff --git a/flexiapi/app/Http/Controllers/Admin/ExternalAccountController.php b/flexiapi/app/Http/Controllers/Admin/ExternalAccountController.php index a7b27fc..a539b6f 100644 --- a/flexiapi/app/Http/Controllers/Admin/ExternalAccountController.php +++ b/flexiapi/app/Http/Controllers/Admin/ExternalAccountController.php @@ -50,17 +50,14 @@ class ExternalAccountController extends Controller public function delete(int $accountId) { - $account = Account::findOrFail($accountId); - return view('admin.account.external.delete', [ - 'account' => $account + 'account' => Account::findOrFail($accountId) ]); } public function destroy(int $accountId) { - $account = Account::findOrFail($accountId); - $account->external->delete(); + (new AccountService)->deleteExternalAccount($accountId); return redirect()->route('admin.account.show', $account->id); } diff --git a/flexiapi/app/Http/Controllers/Api/Admin/ExternalAccountController.php b/flexiapi/app/Http/Controllers/Api/Admin/ExternalAccountController.php index 55e35c0..9fa4e10 100644 --- a/flexiapi/app/Http/Controllers/Api/Admin/ExternalAccountController.php +++ b/flexiapi/app/Http/Controllers/Api/Admin/ExternalAccountController.php @@ -42,7 +42,6 @@ class ExternalAccountController extends Controller public function destroy(int $accountId) { - $account = Account::findOrFail($accountId); - return $account->external->delete(); + return (new AccountService)->deleteExternalAccount($accountId); } } diff --git a/flexiapi/app/Services/AccountService.php b/flexiapi/app/Services/AccountService.php index 14f4e1c..c16f799 100644 --- a/flexiapi/app/Services/AccountService.php +++ b/flexiapi/app/Services/AccountService.php @@ -457,4 +457,15 @@ class AccountService return $externalAccount; } + + public function deleteExternalAccount(int $accountId) + { + $account = Account::findOrFail($accountId); + $externalAccount = $account->external; + + if ($externalAccount) { + (new FlexisipRedisConnector)->pingB2BUA($externalAccount); + return $externalAccount->delete(); + } + } }