Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PKP-LIB][main] #10859 Fix warning related to 'userId' and 'inviteeEmail' when adding an invitation #10860

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api/v1/invitations/InvitationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Route;
use Illuminate\Validation\Rule;
use PKP\core\PKPBaseController;
Expand Down Expand Up @@ -257,7 +258,7 @@ public function add(Request $illuminateRequest): JsonResponse
'nullable',
'required_without:inviteeEmail',
'integer',
new UserMustExistRule($payload['userId']),
new UserMustExistRule(Arr::get($payload, 'userId')),
],
'inviteeEmail' => [
Rule::prohibitedIf(isset($payload['userId'])),
Expand Down Expand Up @@ -288,7 +289,7 @@ public function add(Request $illuminateRequest): JsonResponse
$context = $this->getRequest()->getContext();
$inviter = $this->getRequest()->getUser();

$this->invitation->initialize($payload['userId'], $context->getId(), $payload['inviteeEmail'], $inviter->getId());
$this->invitation->initialize(Arr::get($payload, 'userId'), $context->getId(), Arr::get($payload, 'inviteeEmail'), $inviter->getId());

return $this->selectedHandler->add($illuminateRequest);
}
Expand Down