Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion resources/views/livewire/connection-hub.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,22 @@ class="mb-4 rounded-lg border border-gray-200 bg-gray-50 p-3 dark:border-gray-70
@endif
</div>

<p class="mb-5 text-xs text-gray-500 dark:text-gray-400">Ao unificar, sua conta atual será absorvida por essa conta e você será relogado automaticamente.</p>
<div
class="mb-5 flex items-start gap-3 rounded-lg border border-amber-300/40 bg-amber-50/80 p-3 dark:border-amber-500/20 dark:bg-amber-500/5"
>
<x-filament::icon
icon="heroicon-o-exclamation-triangle"
class="mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"
/>
<div>
<p class="text-sm font-medium text-amber-800 dark:text-amber-300">
A conta @ {{ $mergeTarget['username'] }} será mantida como principal.

@RomuloLim RomuloLim Jul 21, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dúvida genuína: @ username ao invés de @username seria um padrão que o sistema já utiliza?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normalmente é junto, não reparei de ter um padrão para isso sinda

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Acredito que no campo destacado em Verde a visualização fique inclusive mais confortável utilizando o espaçamento, porém acho válido criarmos um padrão para os demais casos, como o destacado em vermelho, mantendo um padrão geral para display de usernames.

</p>
<p class="mt-1 text-xs text-amber-700/80 dark:text-amber-400/70">
Sua conta atual @ {{ auth()->user()->username }} será absorvida e removida. O histórico já associado à conta mantida será preservado. Ao finalizar, você será autenticado novamente na conta @ {{ $mergeTarget['username'] }}.
</p>
</div>
</div>

<div class="flex gap-2">
<x-filament::button wire:click="confirmMerge" color="warning" class="flex-1">
Expand Down
53 changes: 53 additions & 0 deletions tests/Feature/ConnectionHubMergeModalTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

declare(strict_types=1);

use App\Livewire\ConnectionHub;
use Filament\Facades\Filament;
use He4rt\Identity\ExternalIdentity\Enums\IdentityProvider;
use He4rt\Identity\ExternalIdentity\Models\ExternalIdentity;
use He4rt\Identity\User\Models\User;

use function Pest\Livewire\livewire;

test('connection hub merge modal explains which account is kept and absorbed', function (): void {
$keptUser = User::factory()->create([
'username' => 'discord-user',
]);

$currentUser = User::factory()->create([
'username' => 'github-user',
]);

ExternalIdentity::factory()->create([
'model_type' => (new User)->getMorphClass(),
'model_id' => $keptUser->id,
'provider' => IdentityProvider::Discord,
'external_account_id' => 'discord-123',
]);

$this->actingAs($currentUser);
Filament::setCurrentPanel(Filament::getPanel('app'));

session()->put('oauth_merge_pending', [
'conflicting_user_id' => $keptUser->id,
'provider' => IdentityProvider::Discord->value,
'credentials' => [],
'oauth_user' => [
'provider_id' => 'discord-123',
'username' => 'discord-user',
'name' => 'Discord User',
'email' => null,
'avatar_url' => null,
],
]);

livewire(ConnectionHub::class)
->assertSee('Conta existente encontrada')
->assertSee('@ discord-user')
->assertSee('@ github-user')
->assertSee('será mantida como principal')
->assertSee('será absorvida e removida')
->assertSee('histórico já associado à conta mantida será preservado')
->assertSee('será autenticado novamente');
});