mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-07 19:34:33 +08:00
Addressed test failures from users API changes
This commit is contained in:
@ -192,7 +192,7 @@ class UserRepo
|
|||||||
*/
|
*/
|
||||||
public function create(array $data, bool $sendInvite = false): User
|
public function create(array $data, bool $sendInvite = false): User
|
||||||
{
|
{
|
||||||
$user = $this->createWithoutActivity($data, false);
|
$user = $this->createWithoutActivity($data, true);
|
||||||
|
|
||||||
if ($sendInvite) {
|
if ($sendInvite) {
|
||||||
$this->inviteService->sendInvitation($user);
|
$this->inviteService->sendInvitation($user);
|
||||||
|
@ -39,6 +39,11 @@ class NotifyException extends Exception implements Responsable
|
|||||||
{
|
{
|
||||||
$message = $this->getMessage();
|
$message = $this->getMessage();
|
||||||
|
|
||||||
|
// Front-end JSON handling. API-side handling managed via handler.
|
||||||
|
if ($request->wantsJson()) {
|
||||||
|
return response()->json(['error' => $message], 403);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($message)) {
|
if (!empty($message)) {
|
||||||
session()->flash('error', $message);
|
session()->flash('error', $message);
|
||||||
}
|
}
|
||||||
|
@ -140,6 +140,7 @@ class UserController extends Controller
|
|||||||
'language' => ['string'],
|
'language' => ['string'],
|
||||||
'roles' => ['array'],
|
'roles' => ['array'],
|
||||||
'roles.*' => ['integer'],
|
'roles.*' => ['integer'],
|
||||||
|
'external_auth_id' => ['string'],
|
||||||
'profile_image' => array_merge(['nullable'], $this->getImageValidationRules()),
|
'profile_image' => array_merge(['nullable'], $this->getImageValidationRules()),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -45,9 +45,7 @@ class UserInviteTest extends TestCase
|
|||||||
'name' => 'Barry',
|
'name' => 'Barry',
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'send_invite' => 'true',
|
'send_invite' => 'true',
|
||||||
'setting' => [
|
'language' => 'de',
|
||||||
'language' => 'de',
|
|
||||||
],
|
|
||||||
]);
|
]);
|
||||||
$resp->assertRedirect('/settings/users');
|
$resp->assertRedirect('/settings/users');
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class UserManagementTest extends TestCase
|
|||||||
foreach ($langs as $lang) {
|
foreach ($langs as $lang) {
|
||||||
config()->set('app.locale', $lang);
|
config()->set('app.locale', $lang);
|
||||||
$resp = $this->asAdmin()->get('/settings/users/create');
|
$resp = $this->asAdmin()->get('/settings/users/create');
|
||||||
$resp->assertElementExists('select[name="setting[language]"] option[value="' . $lang . '"][selected]');
|
$resp->assertElementExists('select[name="language"] option[value="' . $lang . '"][selected]');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user