mirror of
https://github.com/friendica/friendica
synced 2025-04-26 22:30:18 +00:00
Switch data source from notify to notification in Module\Notifications\Ping
- Change unused FormattedNotification classes to FormattedNavNotification classes
This commit is contained in:
parent
1ae7cac236
commit
49971b1465
7 changed files with 299 additions and 627 deletions
|
@ -100,6 +100,36 @@ class Notification extends BaseRepository
|
|||
return $this->select($condition, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns only the most recent notifications for the same conversation or contact
|
||||
*
|
||||
* @param int $uid
|
||||
* @return Collection\Notifications
|
||||
* @throws Exception
|
||||
*/
|
||||
public function selectDigestForUser(int $uid): Collection\Notifications
|
||||
{
|
||||
$rows = $this->db->p("
|
||||
SELECT notification.*
|
||||
FROM notification
|
||||
WHERE id IN (
|
||||
SELECT MAX(`id`)
|
||||
FROM notification
|
||||
WHERE uid = ?
|
||||
GROUP BY IFNULL(`parent-uri-id`, `actor-id`)
|
||||
)
|
||||
ORDER BY `seen`, `id` DESC
|
||||
LIMIT 50
|
||||
", $uid);
|
||||
|
||||
$Entities = new Collection\Notifications();
|
||||
foreach ($rows as $fields) {
|
||||
$Entities[] = $this->factory->createFromTableRow($fields);
|
||||
}
|
||||
|
||||
return $Entities;
|
||||
}
|
||||
|
||||
public function selectAllForUser(int $uid): Collection\Notifications
|
||||
{
|
||||
return $this->selectForUser($uid);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue