Skip to content

Commit

Permalink
NEUSPRT-266: Optimize log viewing for a contact
Browse files Browse the repository at this point in the history
Applying pr: civicrm#31125
  • Loading branch information
Muhammad Shahrukh committed Sep 17, 2024
1 parent 047979b commit d4983ae
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions CRM/Contact/Page/View/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function browse() {
}

$log = new CRM_Core_DAO_Log();
$modifiers = [];

$log->entity_table = 'civicrm_contact';
$log->entity_id = $this->_contactId;
Expand All @@ -41,11 +42,15 @@ public function browse() {

$logEntries = [];
while ($log->fetch()) {
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($log->modified_id);
if ($log->modified_id && !isset($modifiers[$log->modified_id])) {
$displayInfo = CRM_Contact_BAO_Contact::getDisplayAndImage($log->modified_id);
$modifiers[$log->modified_id] = ['name' => $displayInfo[0] ?? '', 'image' => $displayInfo[1] ?? ''];
}

$logEntries[] = [
'id' => $log->modified_id,
'name' => $displayName,
'image' => $contactImage,
'name' => $log->modified_id && $modifiers[$log->modified_id]['name'] ? $modifiers[$log->modified_id]['name'] : '',
'image' => $log->modified_id && $modifiers[$log->modified_id]['image'] ? $modifiers[$log->modified_id]['image'] : '',
'date' => $log->modified_date,
];
}
Expand Down

0 comments on commit d4983ae

Please sign in to comment.