do not group notification about assignment
This commit is contained in:
@@ -73,7 +73,7 @@ class DefaultAssignmentNotificator implements AssignmentNotificator
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->processForUser($entity, $userId, $params);
|
||||
$this->processForUser($entity, $userId);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -89,10 +89,10 @@ class DefaultAssignmentNotificator implements AssignmentNotificator
|
||||
|
||||
$assignedUserId = $entity->get(self::ATTR_ASSIGNED_USER_ID);
|
||||
|
||||
$this->processForUser($entity, $assignedUserId, $params);
|
||||
$this->processForUser($entity, $assignedUserId);
|
||||
}
|
||||
|
||||
protected function processForUser(Entity $entity, string $assignedUserId, Params $params): void
|
||||
protected function processForUser(Entity $entity, string $assignedUserId): void
|
||||
{
|
||||
if (!$this->userChecker->checkAssignment($entity->getEntityType(), $assignedUserId)) {
|
||||
return;
|
||||
@@ -127,8 +127,7 @@ class DefaultAssignmentNotificator implements AssignmentNotificator
|
||||
'userId' => $this->user->getId(),
|
||||
'userName' => $this->user->getName(),
|
||||
])
|
||||
->setRelated(LinkParent::createFromEntity($entity))
|
||||
->setActionId($params->getActionId());
|
||||
->setRelated(LinkParent::createFromEntity($entity));
|
||||
|
||||
$this->entityManager->saveEntity($notification);
|
||||
}
|
||||
|
||||
@@ -103,8 +103,6 @@ class Service
|
||||
->find();
|
||||
|
||||
foreach ($users as $user) {
|
||||
$userId = $user->getId();
|
||||
|
||||
if (!$this->checkUserNoteAccess($user, $note)) {
|
||||
continue;
|
||||
}
|
||||
@@ -124,6 +122,16 @@ class Service
|
||||
continue;
|
||||
}
|
||||
|
||||
$actionId = $params?->actionId;
|
||||
|
||||
if (
|
||||
in_array($note->getType(), [Note::TYPE_ASSIGN, Note::TYPE_CREATE]) &&
|
||||
($note->getData()->assignedUserId ?? null) === $user->getId()
|
||||
) {
|
||||
// Do not group notifications about assignment.
|
||||
$actionId = null;
|
||||
}
|
||||
|
||||
$notification = $this->entityManager->getRDBRepositoryByClass(Notification::class)->getNew();
|
||||
|
||||
$notification
|
||||
@@ -131,13 +139,13 @@ class Service
|
||||
->set(Field::CREATED_AT, $now)
|
||||
->setData(['noteId' => $note->getId()])
|
||||
->setType(Notification::TYPE_NOTE)
|
||||
->setUserId($userId)
|
||||
->setUserId($user->getId())
|
||||
->setRelated(LinkParent::createFromEntity($notification))
|
||||
->setRelatedParent(
|
||||
$note->getParentType() && $note->getParentId() ?
|
||||
LinkParent::create($note->getParentType(), $note->getParentId()) : null
|
||||
)
|
||||
->setActionId($params?->actionId);
|
||||
->setActionId($actionId);
|
||||
|
||||
$collection[] = $notification;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user