<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
public static function countUnseenItems()
{
$stmtContacts = DBA::p(
- "SELECT `contact`.`id`, `contact`.`name`, COUNT(*) AS `count` FROM `post-view`
- INNER JOIN `contact` ON `post-view`.`contact-id` = `contact`.`id`
- WHERE `post-view`.`uid` = ? AND `post-view`.`visible` AND NOT `post-view`.`deleted` AND `post-view`.`unseen`
+ "SELECT `contact`.`id`, `contact`.`name`, COUNT(*) AS `count` FROM `post-user-view`
+ INNER JOIN `contact` ON `post-user-view`.`contact-id` = `contact`.`id`
+ WHERE `post-user-view`.`uid` = ? AND `post-user-view`.`visible` AND NOT `post-user-view`.`deleted` AND `post-user-view`.`unseen`
AND `contact`.`network` IN (?, ?) AND `contact`.`contact-type` = ?
AND NOT `contact`.`blocked` AND NOT `contact`.`hidden`
AND NOT `contact`.`pending` AND NOT `contact`.`archive`
+ AND `contact`.`uid` = ?
GROUP BY `contact`.`id`",
- local_user(), Protocol::DFRN, Protocol::ACTIVITYPUB, Contact::TYPE_COMMUNITY
+ local_user(), Protocol::DFRN, Protocol::ACTIVITYPUB, Contact::TYPE_COMMUNITY, local_user()
);
return DBA::toArray($stmtContacts);