feat: enable category tree for all users, remove flag (#488)

## Summary
Removes the `CategoryTree` Pennant feature flag so the parent/child
category tree UI is active for all existing and new users.

## Changes
- Delete `app/Features/CategoryTree.php` (flag resolved `false`).
- `CategoryController` — drop `Feature`/`CategoryTreeFeature` imports
and the `categoryTreeEnabled` Inertia prop.
- `parent-category-field.tsx` — remove the `usePage` flag read and `if
(!enabled) return null` gate; the parent field now always renders.

## Testing
- `vendor/bin/pint --dirty` — pass
- `bun run lint` — clean (1 pre-existing unrelated warning in
`chart.tsx`)
- `php artisan test tests/Feature/Settings/CategoryTreeTest.php` — 11
passed
- `php artisan test tests/Feature/Settings/CategoryTest.php` — 32 passed
This commit is contained in:
Víctor Falcón 2026-06-04 13:44:57 +02:00 committed by GitHub
parent 721cbef024
commit f8cc8816a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 0 additions and 35 deletions

View File

@ -1,23 +0,0 @@
<?php
namespace App\Features;
use App\Models\User;
/**
* Gates the parent/child category tree UI for gradual rollout. The backend
* always understands nesting; this flag only controls whether users can create
* and manage nested categories from the interface.
*
* @api
*/
class CategoryTree
{
/**
* Resolve the feature's initial value.
*/
public function resolve(?User $user): bool
{
return false;
}
}

View File

@ -3,7 +3,6 @@
namespace App\Http\Controllers\Settings;
use App\Enums\CategoryDeletionStrategy;
use App\Features\CategoryTree as CategoryTreeFeature;
use App\Http\Controllers\Controller;
use App\Http\Requests\Settings\DeleteCategoryRequest;
use App\Http\Requests\Settings\StoreCategoryRequest;
@ -16,7 +15,6 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Validation\ValidationException;
use Inertia\Inertia;
use Inertia\Response;
use Laravel\Pennant\Feature;
class CategoryController extends Controller
{
@ -36,7 +34,6 @@ class CategoryController extends Controller
return Inertia::render('settings/categories', [
'categories' => $categories,
'categoryTreeEnabled' => Feature::for(auth()->user())->active(CategoryTreeFeature::class),
]);
}

View File

@ -5,7 +5,6 @@ import { getDescendantIds } from '@/lib/category-tree';
import { type Category } from '@/types/category';
import { UUID } from '@/types/uuid';
import { __ } from '@/utils/i18n';
import { usePage } from '@inertiajs/react';
import { useMemo } from 'react';
interface ParentCategoryFieldProps {
@ -24,10 +23,6 @@ export function ParentCategoryField({
excludeId,
error,
}: ParentCategoryFieldProps) {
const enabled =
usePage<{ categoryTreeEnabled?: boolean }>().props
.categoryTreeEnabled ?? false;
const byId = useMemo(
() => new Map(categories.map((c) => [c.id, c])),
[categories],
@ -59,10 +54,6 @@ export function ParentCategoryField({
);
}, [categories, excludeId, byId]);
if (!enabled) {
return null;
}
return (
<div className="space-y-2">
<Label htmlFor="parent_id">{__('Parent category')}</Label>