Mini API: include saved phone in account settings.
Deploy Ladill Mini / deploy (push) Successful in 30s
Deploy Ladill Mini / deploy (push) Successful in 30s
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
1b134d7fd3
commit
06efef53b6
@@ -18,11 +18,27 @@ class AccountController extends Controller
|
|||||||
$account = ladill_account();
|
$account = ladill_account();
|
||||||
$settings = $account->getOrCreateQrSetting();
|
$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([
|
return response()->json([
|
||||||
'data' => [
|
'data' => [
|
||||||
'profile' => [
|
'profile' => [
|
||||||
'name' => $account->name,
|
'name' => $account->name,
|
||||||
'email' => $account->email,
|
'email' => $account->email,
|
||||||
|
'phone' => $phone,
|
||||||
|
'phone_cc' => $phoneCc,
|
||||||
],
|
],
|
||||||
'notifications' => [
|
'notifications' => [
|
||||||
'notify_email' => $settings->notify_email ?: $account->email,
|
'notify_email' => $settings->notify_email ?: $account->email,
|
||||||
|
|||||||
Reference in New Issue
Block a user