mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-27 14:36:05 +00:00
Notification reaction load parent, ref
This commit is contained in:
@@ -63,6 +63,10 @@ class Notification extends Entity
|
||||
public const string FIELD_MESSAGE = 'message';
|
||||
public const string FIELD_TYPE = 'type';
|
||||
public const string FIELD_RELATED_PARENT = 'relatedParent';
|
||||
/**
|
||||
* @since 10.0.0
|
||||
*/
|
||||
public const string FIELD_RELATED = 'related';
|
||||
public const string FIELD_IS_FEATURED = 'isFeatured';
|
||||
|
||||
public const string GROUP_TYPE_RECORD = 'Record';
|
||||
|
||||
@@ -269,6 +269,10 @@ class RecordService
|
||||
$this->loadNoteFields($note, $entity);
|
||||
|
||||
$entity->set('noteData', $note->getValueMap());
|
||||
|
||||
if ($entity->getType() === Notification::TYPE_USER_REACTION) {
|
||||
$entity->loadParentNameField(Notification::FIELD_RELATED_PARENT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -370,11 +374,7 @@ class RecordService
|
||||
|
||||
if ($parentId && $parentType) {
|
||||
if ($notification->getType() !== Notification::TYPE_USER_REACTION) {
|
||||
$parent = $this->entityManager->getEntityById($parentType, $parentId);
|
||||
|
||||
if ($parent) {
|
||||
$note->set('parentName', $parent->get(Field::NAME));
|
||||
}
|
||||
$note->loadParentNameField(Field::PARENT);
|
||||
}
|
||||
} else if (!$note->isGlobal()) {
|
||||
$targetType = $note->getTargetType();
|
||||
@@ -396,11 +396,7 @@ class RecordService
|
||||
$relatedType = $note->getRelatedType();
|
||||
|
||||
if ($relatedId && $relatedType && $notification->getType() !== Notification::TYPE_USER_REACTION) {
|
||||
$related = $this->entityManager->getEntityById($relatedType, $relatedId);
|
||||
|
||||
if ($related) {
|
||||
$note->set('relatedName', $related->get(Field::NAME));
|
||||
}
|
||||
$note->loadParentNameField(Notification::FIELD_RELATED);
|
||||
}
|
||||
|
||||
if ($notification->getType() !== Notification::TYPE_USER_REACTION) {
|
||||
|
||||
Reference in New Issue
Block a user