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 9b66e93b15
commit 0e43618dda
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']) @include('settings.parts.navbar', ['selected' => 'users'])
<div class="card content-wrap auto-height"> <form action="{{ url("/settings/users/{$user->id}") }}" method="POST">
<h1 class="list-heading">{{ trans('settings.users_delete') }}</h1> {!! 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"> <hr class="my-l">
<div class="grid half gap-xl v-center"> <div class="grid half">
<div> <p class="text-neg"><strong>{{ trans('settings.users_delete_confirm') }}</strong></p>
<label class="setting-list-label">{{ trans('settings.users_migrate_ownership') }}</label> <div class="text-right">
<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() !!}
<input type="hidden" name="_method" value="DELETE"> <input type="hidden" name="_method" value="DELETE">
<a href="{{ url("/settings/users/{$user->id}") }}" class="button outline">{{ trans('common.cancel') }}</a> <a href="{{ url("/settings/users/{$user->id}") }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button">{{ trans('common.confirm') }}</button> <button type="submit" class="button">{{ trans('common.confirm') }}</button>
</form> </div>
</div> </div>
</div>
</div> </div>
</form>
</div> </div>
@stop @stop

View File

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