diff --git a/app/Http/Resources/CurrentUserResource.php b/app/Http/Resources/CurrentUserResource.php index 19a8412436..0caef3d01c 100644 --- a/app/Http/Resources/CurrentUserResource.php +++ b/app/Http/Resources/CurrentUserResource.php @@ -4,11 +4,9 @@ namespace App\Http\Resources; -use App\Enums\Feature; use App\Models\Organization; use App\Models\User; use App\Queries\ConversationsQuery; -use App\Services\Features; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; @@ -19,7 +17,7 @@ * was this version, so the app knows to ask. Their Remotes are `null` while turned off, as the web hides them, and * otherwise say who can push to them, whether they share pulls, what the site lets them choose, and the unread count * the web's nav shows. The organizations they are a member of, with their role in each, oldest membership first, and - * whether posting as one is switched on, which the web's Post as menu needs. + * whether they can post as one, which the web's Post as menu needs. * * @mixin User */ @@ -63,7 +61,7 @@ public function toArray(Request $request): array ...OrganizationResource::make($organization)->toArray($request), ]) ->all(), - 'can_post_as_organization' => resolve(Features::class)->enabled(Feature::OrganizationCommits), + 'can_post_as_organization' => true, ]; } } diff --git a/app/Queries/GitHubReadmeQuery.php b/app/Queries/GitHubReadmeQuery.php index cc14bfbc9d..820e9e419b 100644 --- a/app/Queries/GitHubReadmeQuery.php +++ b/app/Queries/GitHubReadmeQuery.php @@ -110,7 +110,7 @@ private function resolveRelativeImages(string $html, string $login): string { return preg_replace_callback( '~]*?\ssrc="\K(?![a-z][a-z0-9+.-]*:|//)[^"]+~i', - fn (array $match): string => "https://raw.githubusercontent.com/{$login}/{$login}/HEAD/".ltrim(preg_replace('~^(?:\./)+~', '', $match[0]) ?? $match[0], '/'), + fn (array $match): string => "https://raw.githubusercontent.com/{$login}/{$login}/HEAD/".mb_ltrim(preg_replace('~^(?:\./)+~', '', $match[0]) ?? $match[0], '/'), $html, ) ?? $html; } diff --git a/tests/Feature/Controllers/Api/CurrentUserControllerTest.php b/tests/Feature/Controllers/Api/CurrentUserControllerTest.php index fba3eae714..bfe38ec4e5 100644 --- a/tests/Feature/Controllers/Api/CurrentUserControllerTest.php +++ b/tests/Feature/Controllers/Api/CurrentUserControllerTest.php @@ -2,14 +2,12 @@ declare(strict_types=1); -use App\Enums\Feature; use App\Enums\OrganizationRole; use App\Models\Commit; use App\Models\Device; use App\Models\Notification; use App\Models\Organization; use App\Models\User; -use App\Services\Features; it('returns the signed-in user with their unread notifications and their pastéis', function (): void { $this->travelTo(now()->setDate(2026, 10, 17)->setTime(9, 15)); @@ -76,7 +74,7 @@ 'unread_count' => 0, ], 'organizations' => [], - 'can_post_as_organization' => false, + 'can_post_as_organization' => true, ], 'unread_notifications_count' => 1, ]); @@ -103,8 +101,6 @@ }); it("returns the organizations the user can post as, oldest membership first, like the web's Post as menu", function (): void { - resolve(Features::class)->update(Feature::OrganizationCommits, true); - $user = User::factory()->create(); $keyPair = apiKeyPairFor($user); $laravel = Organization::factory()->create(['handle' => 'laravel', 'name' => 'Laravel']); @@ -139,19 +135,6 @@ ->assertJsonCount(2, 'data.organizations'); }); -it('says when posting as an organization is switched off, keeping the organizations', function (): void { - resolve(Features::class)->update(Feature::OrganizationCommits, false); - - $user = User::factory()->create(); - $keyPair = apiKeyPairFor($user); - Organization::factory()->create()->members()->attach($user->id, ['role' => OrganizationRole::Member]); - - signedApiRequest($keyPair, 'GET', route('api-current-user.show')) - ->assertOk() - ->assertJsonPath('data.can_post_as_organization', false) - ->assertJsonCount(1, 'data.organizations'); -}); - it('keeps those to the signed-in user, even on their own profile', function (): void { $user = User::factory()->create(['preferred_lane' => 1]); $keyPair = apiKeyPairFor($user);