fix: webhook channel card shows both deliver and presence URLs
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
This commit is contained in:
@@ -163,7 +163,14 @@ footer{position:relative;z-index:1;max-width:880px;width:100%;margin:0 auto;padd
|
|||||||
@foreach($channels as $ch)
|
@foreach($channels as $ch)
|
||||||
<div class="chrow">
|
<div class="chrow">
|
||||||
<span class="n">{{ ['web' => 'Веб', 'telegram' => 'Telegram', 'webhook' => 'Webhook'][$ch['type']] }}</span>
|
<span class="n">{{ ['web' => 'Веб', 'telegram' => 'Telegram', 'webhook' => 'Webhook'][$ch['type']] }}</span>
|
||||||
<span class="note">{{ $ch['type'] === 'web' ? 'этот инбокс' : ($ch['type'] === 'telegram' ? 'чат '.($ch['config']['chat_id'] ?? '—') : ($ch['config']['deliver_url'] ?? '—')) }}</span>
|
@if($ch['type'] === 'webhook')
|
||||||
|
<div class="note">
|
||||||
|
<div>доставка → {{ $ch['config']['deliver_url'] ?? '—' }}</div>
|
||||||
|
<div>присутствие → {{ $ch['config']['presence_url'] ?? '—' }}</div>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<span class="note">{{ $ch['type'] === 'web' ? 'этот инбокс' : 'чат '.($ch['config']['chat_id'] ?? '—') }}</span>
|
||||||
|
@endif
|
||||||
@if($ch['type'] !== 'web')<button class="btn ghost danger" style="padding:6px 12px;font-size:12px" data-delete-channel="{{ $ch['id'] }}">Удалить</button>@endif
|
@if($ch['type'] !== 'web')<button class="btn ghost danger" style="padding:6px 12px;font-size:12px" data-delete-channel="{{ $ch['id'] }}">Удалить</button>@endif
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
28
core/tests/Feature/InboxChannelsTest.php
Normal file
28
core/tests/Feature/InboxChannelsTest.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Enums\ChannelType;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class InboxChannelsTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
public function test_webhook_channel_card_shows_both_urls(): void
|
||||||
|
{
|
||||||
|
$this->get('/', ['X-Remote-User' => 'luci']);
|
||||||
|
User::sole()->channels()->create([
|
||||||
|
'type' => ChannelType::Webhook,
|
||||||
|
'config' => ['deliver_url' => 'https://ha.test/api/webhook/hado', 'presence_url' => 'https://ha.test/api/presence'],
|
||||||
|
'enabled' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->get('/', ['X-Remote-User' => 'luci'])->assertOk()
|
||||||
|
->assertSee('https://ha.test/api/webhook/hado')
|
||||||
|
->assertSee('https://ha.test/api/presence')
|
||||||
|
->assertSeeInOrder(['доставка', 'https://ha.test/api/webhook/hado', 'присутствие', 'https://ha.test/api/presence']);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user