use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Notify\Type;
+use Friendica\Model\Verb;
+use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Temporal;
-use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\XML;
/**
$notifs = ping_get_notifications(local_user());
- $condition = ["`unseen` AND `uid` = ? AND `contact-id` != ?", local_user(), local_user()];
- $fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
- 'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'wall'];
- $params = ['order' => ['received' => true]];
- $items = Item::selectForUser(local_user(), $fields, $condition, $params);
-
+ $condition = ["`unseen` AND `uid` = ? AND NOT `origin` AND (`vid` != ? OR `vid` IS NULL)",
+ local_user(), Verb::getID(Activity::FOLLOW)];
+ $items = Item::selectForUser(local_user(), ['wall', 'uid', 'uri-id'], $condition);
if (DBA::isResult($items)) {
$items_unseen = Item::inArray($items);
$arr = ['items' => $items_unseen];
}
}
}
+ DBA::close($items);
if ($network_count) {
// Find out how unseen network posts are spread across groups
if (DBA::isResult($notifs)) {
foreach ($notifs as $notif) {
- $contact = Contact::getDetailsByURL($notif['url']);
- 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);
- }
+ $contact = Contact::getByURL($notif['url'], false, ['micro', 'id', 'avatar']);
+ $notif['photo'] = Contact::getMicro($contact, $notif['photo']);
$local_time = DateTimeFormat::local($notif['date']);
if ($notification["visible"]
&& !$notification["deleted"]
- && empty($result[$notification["parent"]])
+ && empty($result[$notification['parent']])
) {
// Should we condense the notifications or show them all?
if (DI::pConfig()->get(local_user(), 'system', 'detailed_notif')) {
$result[$notification["id"]] = $notification;
} else {
- $result[$notification["parent"]] = $notification;
+ $result[$notification['parent']] = $notification;
}
}
}