From 06efef53b6517c6fe7963c90233274800f58eb22 Mon Sep 17 00:00:00 2001 From: isaacclad Date: Thu, 11 Jun 2026 13:11:17 +0000 Subject: [PATCH] Mini API: include saved phone in account settings. settings() now fetches phone from the central identity profile (guarded), so the app's Profile screen shows the phone the user previously saved. Co-Authored-By: Claude Opus 4.8 --- .../Controllers/Api/Mini/AccountController.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/Http/Controllers/Api/Mini/AccountController.php b/app/Http/Controllers/Api/Mini/AccountController.php index f2a45cc..f690f7e 100644 --- a/app/Http/Controllers/Api/Mini/AccountController.php +++ b/app/Http/Controllers/Api/Mini/AccountController.php @@ -18,11 +18,27 @@ class AccountController extends Controller $account = ladill_account(); $settings = $account->getOrCreateQrSetting(); + // Phone lives on the central account, not the local mirror — fetch it, + // but never let a transient identity-API hiccup break settings loading. + $phone = ''; + $phoneCc = ''; + try { + $profile = $this->identitySend('GET', '/api/identity/profile?user='.urlencode((string) $account->public_id), []); + if ($profile->successful()) { + $phone = (string) $profile->json('data.phone', ''); + $phoneCc = (string) $profile->json('data.phone_cc', ''); + } + } catch (\Throwable) { + // leave phone blank + } + return response()->json([ 'data' => [ 'profile' => [ 'name' => $account->name, 'email' => $account->email, + 'phone' => $phone, + 'phone_cc' => $phoneCc, ], 'notifications' => [ 'notify_email' => $settings->notify_email ?: $account->email,