Skip to content

Commit 58a40e0

Browse files
committed
pkp#9456 Removed First from the method name
1 parent b5eca50 commit 58a40e0

File tree

6 files changed

+46
-50
lines changed

6 files changed

+46
-50
lines changed

classes/components/listPanels/PKPSelectReviewerListPanel.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function getConfig()
128128
->toArray();
129129
$contextId = $this->getParams['contextId'];
130130
foreach ($reviewers as $key => $reviewer) {
131-
$userPrivateNote = Repo::userPrivateNote()->getFirstUserPrivateNote($reviewer->getId(), $contextId);
131+
$userPrivateNote = Repo::userPrivateNote()->getUserPrivateNote($reviewer->getId(), $contextId);
132132
$reviewers[$key]['userPrivateNote'] = $userPrivateNote?->getNote();
133133
}
134134
$config['lastRoundReviewers'] = $reviewers;
@@ -182,7 +182,7 @@ public function getItems($request)
182182
$contextId = $request->getContext()->getId();
183183
foreach ($reviewers as $reviewer) {
184184
$item = $map->summarizeReviewer($reviewer);
185-
$userPrivateNote = Repo::userPrivateNote()->getFirstUserPrivateNote($reviewer->getId(), $contextId);
185+
$userPrivateNote = Repo::userPrivateNote()->getUserPrivateNote($reviewer->getId(), $contextId);
186186
$item['userPrivateNote'] = $userPrivateNote?->getNote();
187187
$items[] = $item;
188188
}

classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ public function gossip($args, $request)
10111011
return new JSONMessage(false, __('user.authorization.roleBasedAccessDenied'));
10121012
}
10131013

1014-
$userPrivateNote = Repo::userPrivateNote()->getFirstUserPrivateNote($user->getId(), $request->getContext()->getId());
1014+
$userPrivateNote = Repo::userPrivateNote()->getUserPrivateNote($user->getId(), $request->getContext()->getId());
10151015
if (!$userPrivateNote) {
10161016
$userPrivateNote = Repo::userPrivateNote()->newDataObject([
10171017
'userId' => $user->getId(),

classes/migration/install/CommonMigration.php

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
namespace PKP\migration\install;
1616

1717
use APP\core\Application;
18-
use APP\facades\Repo;
1918
use Illuminate\Database\Schema\Blueprint;
2019
use Illuminate\Support\Facades\DB;
2120
use Illuminate\Support\Facades\Schema;

classes/userPrivateNote/Repository.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ public function delete(UserPrivateNote $userPrivateNote): void
113113
/**
114114
* Get the user private note for the specified context.
115115
*
116-
* This returns the first user private note, as the "user ID/context ID" key should be unique.
116+
* This returns the user private note, as the "user ID/context ID" key should be unique.
117117
*/
118-
public function getFirstUserPrivateNote(int $userId, int $contextId): ?UserPrivateNote
118+
public function getUserPrivateNote(int $userId, int $contextId): ?UserPrivateNote
119119
{
120120
return Repo::userPrivateNote()
121121
->getCollector()

classes/userPrivateNote/UserPrivateNote.php

+36-40
Original file line numberDiff line numberDiff line change
@@ -22,68 +22,64 @@
2222

2323
class UserPrivateNote extends DataObject
2424
{
25-
/**
26-
* Get private note context ID.
25+
/**
26+
* Get private note context ID.
2727
*
28-
* @return int
29-
*/
28+
* @return int
29+
*/
3030
public function getContextId(): int
3131
{
32-
return $this->getData('contextId');
33-
}
32+
return $this->getData('contextId');
33+
}
3434

35-
/**
36-
* Set private note context ID.
35+
/**
36+
* Set private note context ID.
3737
*
38-
* @param $contextId int
39-
*/
38+
* @param $contextId int
39+
*/
4040
public function setContextId(int $contextId): void
4141
{
42-
$this->setData('contextId', $contextId);
43-
}
42+
$this->setData('contextId', $contextId);
43+
}
4444

45-
/**
46-
* Get private note user ID.
45+
/**
46+
* Get private note user ID.
4747
*
48-
* @return int
49-
*/
48+
* @return int
49+
*/
5050
public function getUserId(): int
5151
{
52-
return $this->getData('userId');
53-
}
52+
return $this->getData('userId');
53+
}
5454

55-
/**
56-
* Set private note user ID.
55+
/**
56+
* Set private note user ID.
5757
*
58-
* @param $userId int
59-
*/
58+
* @param $userId int
59+
*/
6060
public function setUserId(int $userId): void
6161
{
62-
$this->setData('userId', $userId);
63-
}
62+
$this->setData('userId', $userId);
63+
}
6464

6565

66-
/**
67-
* Get private note value.
66+
/**
67+
* Get private note value.
6868
*
69-
* @return string
70-
*/
69+
* @return string
70+
*/
7171
public function getNote(): string
7272
{
73-
return $this->getData('note');
74-
}
73+
return $this->getData('note');
74+
}
7575

76-
/**
77-
* Set private note value.
76+
/**
77+
* Set private note value.
7878
*
79-
* @param $note string
80-
*/
79+
* @param $note string
80+
*/
8181
public function setNote(string $note): void
8282
{
83-
$this->setData('note', $note);
84-
}
85-
}
86-
87-
if (!PKP_STRICT_MODE) {
88-
class_alias('\PKP\userPrivateNote\UserPrivateNote', '\UserPrivateNote');
83+
$this->setData('note', $note);
84+
}
8985
}

controllers/grid/settings/user/form/UserDetailsForm.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,12 @@ public function initData()
174174
'interests' => $interestManager->getInterestsForUser($user),
175175
'locales' => $user->getLocales(),
176176
];
177-
$data['canCurrentUserGossip'] = Repo::user()->canCurrentUserGossip($user->getId());
177+
$userId = $user->getId();
178+
$data['canCurrentUserGossip'] = Repo::user()->canCurrentUserGossip($userId);
178179
if ($data['canCurrentUserGossip']) {
179180
$data['gossip'] = $user->getGossip();
180-
$userPrivateNote = Repo::userPrivateNote()
181-
->getFirstUserPrivateNote($user->getId(), $request->getContext()->getId());
181+
$contextId = $request->getContext()->getId();
182+
$userPrivateNote = Repo::userPrivateNote()->getUserPrivateNote($userId, $contextId);
182183
$data['userPrivateNote'] = $userPrivateNote ? $userPrivateNote->getNote() : '';
183184
}
184185
} elseif (isset($this->author)) {
@@ -405,7 +406,7 @@ public function execute(...$functionParams)
405406

406407
// Users can never view/edit their own private notes fields
407408
if (Repo::user()->canCurrentUserGossip($userId)) {
408-
$userPrivateNote = Repo::userPrivateNote()->getFirstUserPrivateNote($userId, $context->getId());
409+
$userPrivateNote = Repo::userPrivateNote()->getUserPrivateNote($userId, $context->getId());
409410
Repo::userPrivateNote()->edit($userPrivateNote, ['note', $this->getData('userPrivateNote')]);
410411
}
411412

0 commit comments

Comments
 (0)