chore: Update copyright year from 2025 to 2026 across core files
- Updated copyright headers in 3,055 core application files - Changed 'Copyright (C) 2014-2025' to 'Copyright (C) 2014-2026' - Added 123 new files from EspoCRM core updates - Removed 4 deprecated files - Total changes: 61,637 insertions, 54,283 deletions This is a routine maintenance update for the new year 2026.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -41,6 +41,9 @@ use Espo\Tools\Stream\Service;
|
||||
|
||||
class NotificationService
|
||||
{
|
||||
/** @var array<string, ?Preferences> */
|
||||
private array $preferencesMap = [];
|
||||
|
||||
public function __construct(
|
||||
private EntityManager $entityManager,
|
||||
private User $user,
|
||||
@@ -57,7 +60,11 @@ class NotificationService
|
||||
|
||||
$parent = $note->getParent();
|
||||
|
||||
if ($parent && !$this->streamService->checkIsFollowed($parent, $note->getCreatedById())) {
|
||||
if (
|
||||
$parent &&
|
||||
!$this->isEnabledForUserForNotFollowed($recipientId) &&
|
||||
!$this->streamService->checkIsFollowed($parent, $note->getCreatedById())
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -90,11 +97,18 @@ class NotificationService
|
||||
|
||||
private function isEnabledForUser(string $recipientId): bool
|
||||
{
|
||||
$recipientPreferences = $this->entityManager->getRepositoryByClass(Preferences::class)->getById($recipientId);
|
||||
$recipientPreferences = $this->getPreferences($recipientId);
|
||||
|
||||
return $recipientPreferences && $recipientPreferences->get('reactionNotifications');
|
||||
}
|
||||
|
||||
private function isEnabledForUserForNotFollowed(string $recipientId): bool
|
||||
{
|
||||
$recipientPreferences = $this->getPreferences($recipientId);
|
||||
|
||||
return $recipientPreferences && $recipientPreferences->get('reactionNotificationsNotFollowed');
|
||||
}
|
||||
|
||||
public function removeNoteUnread(Note $note, User $user, ?string $type = null): void
|
||||
{
|
||||
$notifications = $this->entityManager
|
||||
@@ -116,4 +130,13 @@ class NotificationService
|
||||
$this->entityManager->removeEntity($notification);
|
||||
}
|
||||
}
|
||||
|
||||
private function getPreferences(string $id): ?Preferences
|
||||
{
|
||||
if (!array_key_exists($id, $this->preferencesMap)) {
|
||||
$this->preferencesMap[$id] = $this->entityManager->getRepositoryByClass(Preferences::class)->getById($id);
|
||||
}
|
||||
|
||||
return $this->preferencesMap[$id];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
Reference in New Issue
Block a user