mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Fixed settings redirect issue and custom head display
- Fixed issue where redirect for `/settings` view would not be ran through base url generator so would not create a correct path in some cases. Now routed through controller with normal redirect. - Fixed custom head content being active on settings pages due to route name changes, for when viewing settings, in last release. Fixes #3356 and #3355
This commit is contained in:
parent
135022136a
commit
da4308bb0f
@ -19,9 +19,17 @@ class SettingController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the settings.
|
||||
* Handle requests to the settings index path
|
||||
*/
|
||||
public function index(string $category)
|
||||
public function index()
|
||||
{
|
||||
return redirect('/settings/features');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the settings for the given category.
|
||||
*/
|
||||
public function category(string $category)
|
||||
{
|
||||
$this->ensureCategoryExists($category);
|
||||
$this->checkPermission('settings-manage');
|
||||
|
@ -1,6 +1,6 @@
|
||||
@inject('headContent', 'BookStack\Theming\CustomHtmlHeadContentProvider')
|
||||
|
||||
@if(setting('app-custom-head') && \Route::currentRouteName() !== 'settings')
|
||||
@if(setting('app-custom-head') && !request()->routeIs('settings.category'))
|
||||
<!-- Start: custom user content -->
|
||||
{!! $headContent->forWeb() !!}
|
||||
<!-- End: custom user content -->
|
||||
|
@ -265,8 +265,8 @@ Route::middleware('auth')->group(function () {
|
||||
Route::delete('/settings/webhooks/{id}', [WebhookController::class, 'destroy']);
|
||||
|
||||
// Settings
|
||||
Route::redirect('/settings', '/settings/features')->name('settings');
|
||||
Route::get('/settings/{category}', [SettingController::class, 'index']);
|
||||
Route::get('/settings', [SettingController::class, 'index'])->name('settings');
|
||||
Route::get('/settings/{category}', [SettingController::class, 'category'])->name('settings.category');
|
||||
Route::post('/settings/{category}', [SettingController::class, 'update']);
|
||||
});
|
||||
|
||||
|
@ -26,7 +26,7 @@ class CustomHeadContentTest extends TestCase
|
||||
public function test_configured_content_does_not_show_on_settings_page()
|
||||
{
|
||||
$this->setSettings(['app-custom-head' => '<script>console.log("cat");</script>']);
|
||||
$resp = $this->asAdmin()->get('/settings');
|
||||
$resp = $this->asAdmin()->get('/settings/features');
|
||||
$resp->assertDontSee('console.log("cat")', false);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,11 @@ class SettingsTest extends TestCase
|
||||
{
|
||||
$resp = $this->asAdmin()->get('/settings');
|
||||
|
||||
$resp->assertRedirect('/settings/features');
|
||||
$resp->assertStatus(302);
|
||||
|
||||
// Manually check path to ensure it's generated as the full path
|
||||
$location = $resp->headers->get('location');
|
||||
$this->assertEquals(url('/settings/features'), $location);
|
||||
}
|
||||
|
||||
public function test_settings_category_links_work_as_expected()
|
||||
|
Loading…
Reference in New Issue
Block a user