- switch ($row['post-reason']) {
- case Item::PR_TO:
- $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'to')];
- break;
- case Item::PR_CC:
- $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'cc')];
- break;
- case Item::PR_BTO:
- $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bto')];
- break;
- case Item::PR_BCC:
- $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bcc')];
- break;
- case Item::PR_FOLLOWER:
- $row['direction'] = ['direction' => 6, 'title' => DI::l10n()->t('You are following %s.', $row['author-name'])];
- break;
- case Item::PR_TAG:
- $row['direction'] = ['direction' => 4, 'title' => DI::l10n()->t('Tagged')];
- break;
- case Item::PR_ANNOUNCEMENT:
- if (!empty($row['causer-id']) && DI::pConfig()->get(local_user(), 'system', 'display_resharer')) {
- $row['owner-id'] = $row['causer-id'];
- $row['owner-link'] = $row['causer-link'];
- $row['owner-avatar'] = $row['causer-avatar'];
- $row['owner-name'] = $row['causer-name'];
- }
+ if (!empty($activity)) {
+ if (($row['gravity'] == GRAVITY_PARENT)) {
+ $row['post-reason'] = Item::PR_ANNOUNCEMENT;
+ $row = array_merge($row, $activity);
+ $contact = Contact::getById($activity['causer-id'], ['url', 'name', 'thumb']);
+ $row['causer-link'] = $contact['url'];
+ $row['causer-avatar'] = $contact['thumb'];
+ $row['causer-name'] = $contact['name'];
+ } elseif (($row['gravity'] == GRAVITY_ACTIVITY) && ($row['verb'] == Activity::ANNOUNCE) &&
+ ($row['author-id'] == $activity['causer-id'])) {
+ return $row;
+ }
+ }