- if (DBA::isResult($notifs)) {
- foreach ($notifs as $notif) {
- $contact = Contact::getByURL($notif['url'], false, ['micro']);
- if (isset($contact['micro'])) {
- $notif['photo'] = ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO);
- } else {
- $notif['photo'] = ProxyUtils::proxifyUrl($notif['photo'], false, ProxyUtils::SIZE_MICRO);
- }
-
- $local_time = DateTimeFormat::local($notif['date']);
-
- $notifications[] = [
- 'id' => $notif['id'],
- 'href' => $notif['href'],
- 'name' => $notif['name'],
- 'url' => $notif['url'],
- 'photo' => $notif['photo'],
- 'date' => Temporal::getRelativeDate($notif['date']),
- 'message' => $notif['message'],
- 'seen' => $notif['seen'],
- 'timestamp' => strtotime($local_time)
- ];
- }
- }
+ array_walk($notifications, function (&$notification) {
+ $notification['photo'] = Contact::getAvatarUrlForUrl($notification['url'], local_user(), Proxy::SIZE_MICRO);
+ $notification['timestamp'] = DateTimeFormat::local($notification['date']);
+ $notification['date'] = Temporal::getRelativeDate($notification['date']);
+ });