Notification reaction load parent, ref

This commit is contained in:
Yurii
2026-06-26 18:33:42 +03:00
parent 3674fc0204
commit e66521db1b
2 changed files with 10 additions and 10 deletions

View File

@@ -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';

View File

@@ -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) {