1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-23 03:12:32 +01:00

Fixed issue with user delete ownership not migrating

Caused by input not being part of the submitted form.
Updated test to ensure the input is within a form.
For #4124
This commit is contained in:
Dan Brown 2023-03-24 14:43:48 +00:00
parent ea7914422c
commit 6e284d7a6c
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
2 changed files with 27 additions and 26 deletions

View File

@ -5,40 +5,40 @@
@include('settings.parts.navbar', ['selected' => 'users'])
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ trans('settings.users_delete') }}</h1>
<form action="{{ url("/settings/users/{$user->id}") }}" method="POST">
{!! csrf_field() !!}
<p>{{ trans('settings.users_delete_warning', ['userName' => $user->name]) }}</p>
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ trans('settings.users_delete') }}</h1>
<p>{{ trans('settings.users_delete_warning', ['userName' => $user->name]) }}</p>
@if(userCan('users-manage'))
<hr class="my-l">
<div class="grid half gap-xl v-center">
<div>
<label class="setting-list-label">{{ trans('settings.users_migrate_ownership') }}</label>
<p class="small">{{ trans('settings.users_migrate_ownership_desc') }}</p>
</div>
<div>
@include('form.user-select', ['name' => 'new_owner_id', 'user' => null])
</div>
</div>
@endif
@if(userCan('users-manage'))
<hr class="my-l">
<div class="grid half gap-xl v-center">
<div>
<label class="setting-list-label">{{ trans('settings.users_migrate_ownership') }}</label>
<p class="small">{{ trans('settings.users_migrate_ownership_desc') }}</p>
</div>
<div>
@include('form.user-select', ['name' => 'new_owner_id', 'user' => null])
</div>
</div>
@endif
<hr class="my-l">
<div class="grid half">
<p class="text-neg"><strong>{{ trans('settings.users_delete_confirm') }}</strong></p>
<div>
<form action="{{ url("/settings/users/{$user->id}") }}" method="POST" class="text-right">
{!! csrf_field() !!}
<div class="grid half">
<p class="text-neg"><strong>{{ trans('settings.users_delete_confirm') }}</strong></p>
<div class="text-right">
<input type="hidden" name="_method" value="DELETE">
<a href="{{ url("/settings/users/{$user->id}") }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button">{{ trans('common.confirm') }}</button>
</form>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
@stop

View File

@ -145,6 +145,7 @@ class UserManagementTest extends TestCase
$resp = $this->asEditor()->get("settings/users/{$editor->id}/delete");
$resp->assertSee('Migrate Ownership');
$this->withHtml($resp)->assertElementExists('form input[name="new_owner_id"]');
$resp->assertSee('new_owner_id');
}