From 3a0ad8b206c9a4b9abd70ece138e09f2a2d2198d Mon Sep 17 00:00:00 2001 From: roble Date: Sat, 7 Nov 2026 15:29:29 +0000 Subject: [PATCH] fix: ask for a verified address to suggest, vote and comment on the roadmap (sc-1134) Co-Authored-By: Claude Opus 5.5 --- .../saucebase-roadmap-development/SKILL.md | 2 +- routes/web.php | 2 +- tests/Feature/RoadmapRouteMiddlewareTest.php | 35 +++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 tests/Feature/RoadmapRouteMiddlewareTest.php diff --git a/resources/boost/skills/saucebase-roadmap-development/SKILL.md b/resources/boost/skills/saucebase-roadmap-development/SKILL.md index 8c22acc..8aa5e25 100644 --- a/resources/boost/skills/saucebase-roadmap-development/SKILL.md +++ b/resources/boost/skills/saucebase-roadmap-development/SKILL.md @@ -45,7 +45,7 @@ Writes go through `src/Actions/`: `SubmitSuggestion`, `ToggleVote` and `MergeIte ### Public Page, Optional Login -`roadmap.index` and `roadmap.show` are outside the `auth` middleware — they are the marketing surface and are in the sitemap. Voting, commenting, and suggesting are inside it (`roadmap.vote`, `roadmap.comments.store`, `roadmap.store`). Both pages send an `authenticated` prop so the frontend sends guests to login instead of hiding the buttons. +`roadmap.index` and `roadmap.show` are outside the `auth` middleware — they are the marketing surface and are in the sitemap. Voting, commenting, and suggesting are inside `auth` and `verified` (`roadmap.vote`, `roadmap.comments.store`, `roadmap.store`); `verified` only acts once the app's User implements `MustVerifyEmail` (sc-1134). Both pages send an `authenticated` prop so the frontend sends guests to login instead of hiding the buttons. ### Page Or Slideover, Same URL diff --git a/routes/web.php b/routes/web.php index f49656d..f6d4294 100644 --- a/routes/web.php +++ b/routes/web.php @@ -9,7 +9,7 @@ Route::get('/roadmap', [RoadmapController::class, 'index'])->name('roadmap.index'); Route::get('/roadmap/{item:slug}', [RoadmapController::class, 'show'])->name('roadmap.show'); - Route::middleware('auth')->group(function (): void { + Route::middleware(['auth', 'verified'])->group(function (): void { Route::post('/roadmap', [RoadmapController::class, 'store'])->middleware('throttle:roadmap-suggest')->name('roadmap.store'); Route::post('/roadmap/{item}/vote', [RoadmapVoteController::class, 'store'])->middleware('throttle:roadmap-vote')->name('roadmap.vote'); Route::post('/roadmap/{item:slug}', [RoadmapCommentController::class, 'store'])->middleware('throttle:roadmap-comment')->name('roadmap.comments.store'); diff --git a/tests/Feature/RoadmapRouteMiddlewareTest.php b/tests/Feature/RoadmapRouteMiddlewareTest.php new file mode 100644 index 0000000..c1b2c84 --- /dev/null +++ b/tests/Feature/RoadmapRouteMiddlewareTest.php @@ -0,0 +1,35 @@ + */ + public static function writes(): array + { + return [ + 'suggest' => ['roadmap.store'], + 'vote' => ['roadmap.vote'], + 'comment' => ['roadmap.comments.store'], + ]; + } + + #[DataProvider('writes')] + public function test_writing_to_the_board_needs_a_verified_address(string $name): void + { + $router = app(Router::class); + $route = $router->getRoutes()->getByName($name); + + $this->assertNotNull($route); + $this->assertContains('verified', $route->gatherMiddleware()); + } +}