Commit ff8fea4f authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: guest profile shows 'ضيف' instead of default DB name

Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent b3c62506
......@@ -152,10 +152,15 @@ function handleGuest(): void {
$userId = $data['user']['id'];
// Create guest profile
// Ensure guest profile has proper display name
$sdb = supabaseService();
$existing = $sdb->get('profiles', ['id' => 'eq.' . $userId, 'select' => 'id', 'limit' => 1]);
if (empty($existing) || isset($existing['error'])) {
$existing = $sdb->get('profiles', ['id' => 'eq.' . $userId, 'select' => 'id,display_name', 'limit' => 1]);
if (is_array($existing) && !isset($existing['error']) && !empty($existing)) {
$current = $existing[0];
if (!$current['display_name'] || $current['display_name'] === 'لاعب جديد' || $current['display_name'] === 'Player') {
$sdb->update('profiles', ['display_name' => 'ضيف', 'username' => 'guest_' . substr($userId, 0, 8)], ['id' => 'eq.' . $userId]);
}
} else {
$sdb->insert('profiles', [
'id' => $userId,
'display_name' => 'ضيف',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment