Skip to content

Commit fe0eafd

Browse files
simonhampclaude
andcommitted
Truncate long support URLs on plugin show page
Strip https:// prefix and limit display text to 25 characters with full URL available on hover via title attribute. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 16d5476 commit fe0eafd

2 files changed

Lines changed: 60 additions & 2 deletions

File tree

resources/views/plugin-show.blade.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,11 @@ class="inline-flex items-center gap-1 text-sm font-medium text-indigo-600 hover:
354354
<a
355355
href="{{ $plugin->support_channel }}"
356356
target="_blank"
357+
title="{{ $plugin->support_channel }}"
357358
class="inline-flex items-center gap-1 text-sm font-medium text-indigo-600 hover:text-indigo-700 dark:text-indigo-400 dark:hover:text-indigo-300"
358359
>
359-
{{ $plugin->support_channel }}
360-
<x-heroicon-o-arrow-top-right-on-square class="size-3" />
360+
{{ Str::limit(preg_replace('#^https?://#', '', $plugin->support_channel), 25) }}
361+
<x-heroicon-o-arrow-top-right-on-square class="size-3 shrink-0" />
361362
</a>
362363
@elseif (filter_var($plugin->support_channel, FILTER_VALIDATE_EMAIL))
363364
<a
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
namespace Tests\Feature;
4+
5+
use App\Features\ShowPlugins;
6+
use App\Models\Plugin;
7+
use Illuminate\Foundation\Testing\RefreshDatabase;
8+
use Laravel\Pennant\Feature;
9+
use Tests\TestCase;
10+
11+
class PluginShowSupportChannelTest extends TestCase
12+
{
13+
use RefreshDatabase;
14+
15+
protected function setUp(): void
16+
{
17+
parent::setUp();
18+
19+
Feature::define(ShowPlugins::class, true);
20+
}
21+
22+
public function test_long_support_url_is_truncated_in_display_text(): void
23+
{
24+
$plugin = Plugin::factory()->approved()->create([
25+
'support_channel' => 'https://github.com/SRWieZ/nativephp-mobile-packages',
26+
]);
27+
28+
$response = $this->get(route('plugins.show', $plugin->routeParams()));
29+
30+
$response->assertStatus(200);
31+
$response->assertSee('github.com/SRWieZ/nativep...', false);
32+
}
33+
34+
public function test_support_url_display_strips_protocol(): void
35+
{
36+
$plugin = Plugin::factory()->approved()->create([
37+
'support_channel' => 'https://example.com/support',
38+
]);
39+
40+
$response = $this->get(route('plugins.show', $plugin->routeParams()));
41+
42+
$response->assertStatus(200);
43+
$response->assertSee('example.com/support', false);
44+
}
45+
46+
public function test_email_support_channel_is_not_truncated(): void
47+
{
48+
$plugin = Plugin::factory()->approved()->create([
49+
'support_channel' => 'support@example.com',
50+
]);
51+
52+
$response = $this->get(route('plugins.show', $plugin->routeParams()));
53+
54+
$response->assertStatus(200);
55+
$response->assertSee('support@example.com', false);
56+
}
57+
}

0 commit comments

Comments
 (0)