Skip to content

Commit

Permalink
pkp#10306 removed unnecessary request param from createNotification m…
Browse files Browse the repository at this point in the history
…ethod
  • Loading branch information
touhidurabir committed Sep 15, 2024
1 parent 2cad824 commit c82b9ad
Show file tree
Hide file tree
Showing 21 changed files with 5 additions and 29 deletions.
1 change: 0 additions & 1 deletion api/v1/submissions/PKPSubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,6 @@ public function versionPublication(Request $illuminateRequest): JsonResponse
$notificationSubscriptionSettingsDao = DAORegistry::getDAO('NotificationSubscriptionSettingsDAO');
foreach ($usersIterator as $user) {
$notification = $notificationManager->createNotification(
$request,
$user->getId(),
Notification::NOTIFICATION_TYPE_SUBMISSION_NEW_VERSION,
$submission->getData('contextId'),
Expand Down
1 change: 0 additions & 1 deletion classes/context/SubEditorsDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ public function assignEditors(Submission $submission, Context $context): Collect
// Send a notification to assigned users
foreach ($assignments as $assignment) {
$notificationManager->createNotification(
Application::get()->getRequest(),
$assignment->userId,
Notification::NOTIFICATION_TYPE_SUBMISSION_SUBMITTED,
$submission->getData('contextId'),
Expand Down
1 change: 0 additions & 1 deletion classes/decision/DecisionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ protected function createReviewRound(Submission $submission, int $stageId, ?int
if ($count == 0) {
$notificationMgr = new NotificationManager();
$notificationMgr->createNotification(
Application::get()->getRequest(),
null,
Notification::NOTIFICATION_TYPE_REVIEW_ROUND_STATUS,
$submission->getData('contextId'),
Expand Down
4 changes: 2 additions & 2 deletions classes/notification/NotificationManagerDelegate.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public function updateNotification(PKPRequest $request, ?array $userIds, int $as
*
* @copydoc PKPNotificationOperationManager::createNotification()
*/
public function createNotification(?PKPRequest $request = null, ?int $userId = null, ?int $notificationType = null, ?int $contextId = Application::SITE_CONTEXT_ID, ?int $assocType = null, ?int $assocId = null, int $level = Notification::NOTIFICATION_LEVEL_NORMAL, ?array $params = null): ?Notification
public function createNotification(?int $userId = null, ?int $notificationType = null, ?int $contextId = Application::SITE_CONTEXT_ID, ?int $assocType = null, ?int $assocId = null, int $level = Notification::NOTIFICATION_LEVEL_NORMAL, ?array $params = null): ?Notification
{
assert($notificationType == $this->getNotificationType() || $this->multipleTypesUpdate());
return parent::createNotification($request, $userId, $notificationType, $contextId, $assocType, $assocId, $level, $params);
return parent::createNotification($userId, $notificationType, $contextId, $assocType, $assocId, $level, $params);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions classes/notification/PKPNotificationOperationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function getParamsForCurrentLocale(array $params): array
/**
* Create a new notification with the specified arguments and insert into DB
*/
public function createNotification(?PKPRequest $request = null, ?int $userId = null, ?int $notificationType = null, ?int $contextId = Application::SITE_CONTEXT_ID, ?int $assocType = null, ?int $assocId = null, int $level = Notification::NOTIFICATION_LEVEL_NORMAL, ?array $params = null): ?Notification
public function createNotification(?int $userId = null, ?int $notificationType = null, ?int $contextId = Application::SITE_CONTEXT_ID, ?int $assocType = null, ?int $assocId = null, int $level = Notification::NOTIFICATION_LEVEL_NORMAL, ?array $params = null): ?Notification
{
if ($userId && in_array($notificationType, $this->getUserBlockedNotifications($userId, $contextId))) {
return null;
Expand Down Expand Up @@ -228,7 +228,7 @@ public function formatToGeneralNotification(PKPRequest $request, array $notifica
*/
public function formatToInPlaceNotification(PKPRequest $request, array $notifications): array
{
$formattedNotificationsData = null;
$formattedNotificationsData = [];

$templateMgr = TemplateManager::getManager($request);
foreach ($notifications as $notification) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public function getStyleClass($notification): string
public function notify(User $user): ?Notification
{
return parent::createNotification(
Application::get()->getRequest(),
$user->getId(),
Notification::NOTIFICATION_TYPE_NEW_ANNOUNCEMENT,
$this->_announcement->getAssocId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public function updateNotification(PKPRequest $request, ?array $userIds, int $as
} elseif (!$editorAssigned && !$notification) {
// Create a notification.
$this->createNotification(
$request,
null,
$this->getNotificationType(),
$context->getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public function updateNotification(PKPRequest $request, ?array $userIds, int $as
// got here from the editor decision which sends its own email.
foreach ((array) $userIds as $userId) {
$this->createNotification(
$request,
$userId,
$this->getNotificationType(),
$request->getContext()->getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public function getStyleClass(Notification $notification): string
public function notify(User $user): ?Notification
{
return parent::createNotification(
$this->_request,
$user->getId(),
Notification::NOTIFICATION_TYPE_EDITORIAL_REPORT,
$this->_context->getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public function updateNotification(PKPRequest $request, ?array $userIds, int $as
if (!$notification && $isPublished == $forPublicationState) {
// Create notification.
$this->createNotification(
$request,
null,
$type,
$submission->getData('contextId'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public function updateNotification(PKPRequest $request, ?array $userIds, int $as
if ($notificationType == Notification::NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS) {
// Add 'awaiting representations' notification
$this->_createNotification(
$request,
$submissionId,
$editorStageAssignment->userId,
$notificationType,
Expand All @@ -145,7 +144,6 @@ public function updateNotification(PKPRequest $request, ?array $userIds, int $as
if ($notificationType == Notification::NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER) {
// Add 'assign a user' notification
$this->_createNotification(
$request,
$submissionId,
$editorStageAssignment->userId,
$notificationType,
Expand All @@ -170,7 +168,6 @@ public function updateNotification(PKPRequest $request, ?array $userIds, int $as
if ($notificationType == Notification::NOTIFICATION_TYPE_AWAITING_COPYEDITS) {
// Add 'awaiting copyedits' notification
$this->_createNotification(
$request,
$submissionId,
$editorStageAssignment->userId,
$notificationType,
Expand All @@ -184,7 +181,6 @@ public function updateNotification(PKPRequest $request, ?array $userIds, int $as
if ($notificationType == Notification::NOTIFICATION_TYPE_ASSIGN_COPYEDITOR) {
// Add 'assign a copyeditor' notification
$this->_createNotification(
$request,
$submissionId,
$editorStageAssignment->userId,
$notificationType,
Expand Down Expand Up @@ -219,7 +215,7 @@ public function _removeNotification(int $submissionId, int $userId, int $notific
/**
* Create a notification if none exists.
*/
public function _createNotification(PKPRequest $request, int $submissionId, int $userId, int $notificationType, ?int $contextId): void
public function _createNotification(int $submissionId, int $userId, int $notificationType, ?int $contextId): void
{
$notification = Notification::withAssoc(Application::ASSOC_TYPE_SUBMISSION, $submissionId)
->withUserId($userId)
Expand All @@ -229,7 +225,6 @@ public function _createNotification(PKPRequest $request, int $submissionId, int
if (!$notification) {
$notificationMgr = new NotificationManager();
$notificationMgr->createNotification(
$request,
$userId,
$notificationType,
$contextId,
Expand Down
1 change: 0 additions & 1 deletion classes/observers/listeners/AssignEditors.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public function handle(SubmissionSubmitted $event)

// Send notification
$notification = $notificationManager->createNotification(
Application::get()->getRequest(),
$manager->getId(),
Notification::NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED,
$event->context->getId(),
Expand Down
1 change: 0 additions & 1 deletion classes/query/QueryDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ public function addQuery(int $submissionId, int $stageId, string $title, string

foreach ($participantUserIds as $participantUserId) {
$notificationMgr->createNotification(
Application::get()->getRequest(),
$participantUserId,
Notification::NOTIFICATION_TYPE_NEW_QUERY,
$contextId,
Expand Down
1 change: 0 additions & 1 deletion classes/submission/action/EditorAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public function addReviewer($request, $submission, $reviewerId, &$reviewRound, $
// Add notification
$notificationMgr = new NotificationManager();
$notificationMgr->createNotification(
$request,
$reviewerId,
Notification::NOTIFICATION_TYPE_REVIEW_ASSIGNMENT,
$submission->getData('contextId'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public function execute(...$functionParams)

// Notify editors
$notification = $notificationMgr->createNotification(
Application::get()->getRequest(),
$userId,
Notification::NOTIFICATION_TYPE_REVIEWER_COMMENT,
$submission->getData('contextId'),
Expand Down
1 change: 0 additions & 1 deletion controllers/grid/queries/QueriesGridHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,6 @@ public function updateQuery($args, $request)
$user = Repo::user()->get((int) $userId);

$notification = $notificationMgr->createNotification(
$request,
$userId,
Notification::NOTIFICATION_TYPE_NEW_QUERY,
$request->getContext()->getId(),
Expand Down
1 change: 0 additions & 1 deletion controllers/grid/queries/QueryNotesGridHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ protected function insertedNoteNotify(Note $note): void

// Notify the user of a new query.
$notification = $notificationManager->createNotification(
$request,
$userId,
Notification::NOTIFICATION_TYPE_QUERY_ACTIVITY,
$request->getContext()->getId(),
Expand Down
1 change: 0 additions & 1 deletion controllers/grid/users/reviewer/form/EditReviewForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ public function execute(...$functionArgs)
$context = $request->getContext();

$notification = $notificationManager->createNotification(
$request,
$reviewAssignment->getReviewerId(),
Notification::NOTIFICATION_TYPE_REVIEW_ASSIGNMENT_UPDATED,
$context->getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ public function sendMessage(int $userId, Submission $submission, Request $reques
// Send the email
$notificationMgr = new NotificationManager();
$notification = $notificationMgr->createNotification(
$request,
$userId,
Notification::NOTIFICATION_TYPE_NEW_QUERY,
$request->getContext()->getId(),
Expand Down Expand Up @@ -349,7 +348,6 @@ private function _addAssignmentTaskNotification($request, $type, $userId, $submi
$context = $request->getContext();
$notificationMgr = new NotificationManager();
$notificationMgr->createNotification(
$request,
$userId,
$type,
$context->getId(),
Expand Down
1 change: 0 additions & 1 deletion jobs/email/EditorialReminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public function handle(): void

$notificationManager = new NotificationManager();
$notification = $notificationManager->createNotification(
Application::get()->getRequest(),
$this->editorId,
Notification::NOTIFICATION_TYPE_EDITORIAL_REMINDER,
$this->contextId
Expand Down
1 change: 0 additions & 1 deletion jobs/notifications/StatisticsReportMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public function handle()

$notificationManager = new NotificationManager();
$notification = $notificationManager->createNotification(
Application::get()->getRequest(),
$user->getId(),
Notification::NOTIFICATION_TYPE_EDITORIAL_REPORT,
$this->contextId
Expand Down

0 comments on commit c82b9ad

Please sign in to comment.