<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Core\Protocol;
use Friendica\Core\Session\ISession;
use Friendica\Database\Database;
-use Friendica\Model\Item;
+use Friendica\Model\Contact;
+use Friendica\Model\Post;
use Friendica\Module\BaseNotifications;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Object\Api\Friendica\Notification as ApiNotification;
{
/** @var Database */
private $dba;
- /** @var Repository\Notify */
+ /** @var Repository\Notification */
private $notification;
/** @var BaseURL */
private $baseUrl;
/** @var L10n */
private $l10n;
- /** @var string */
- private $nurl;
- public function __construct(LoggerInterface $logger, Database $dba, Repository\Notify $notification, BaseURL $baseUrl, L10n $l10n, App $app, IPConfig $pConfig, ISession $session)
+ public function __construct(LoggerInterface $logger, Database $dba, Repository\Notification $notification, BaseURL $baseUrl, L10n $l10n, App $app, IPConfig $pConfig, ISession $session)
{
parent::__construct($logger);
$this->notification = $notification;
$this->baseUrl = $baseUrl;
$this->l10n = $l10n;
- $this->nurl = $app->contact['nurl'] ?? '';
}
/**
$formattedNotifications[] = new \Friendica\Object\Notification\Notification([
'label' => 'notification',
'link' => $this->baseUrl->get(true) . '/notification/' . $notification->id,
- 'image' => Proxy::proxifyUrl($notification->photo, false, Proxy::SIZE_MICRO),
+ 'image' => Contact::getAvatarUrlForUrl($notification->url, $notification->uid, Proxy::SIZE_MICRO),
'url' => $notification->url,
'text' => strip_tags(BBCode::convert($notification->msg)),
'when' => DateTimeFormat::local($notification->date, 'r'),
$formattedNotifications = [];
try {
- $items = Item::selectForUser(local_user(), $fields, $conditions, $params);
+ $items = Post::selectForUser(local_user(), $fields, $conditions, $params);
while ($item = $this->dba->fetch($items)) {
$formattedNotifications[] = $this->createFromItem($item);
*/
public function getPersonalList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT)
{
- $myUrl = str_replace('http://', '', $this->nurl);
- $diaspUrl = str_replace('/profile/', '/u/', $myUrl);
-
- $condition = ["NOT `wall` AND `uid` = ? AND (`item`.`author-id` = ? OR `item`.`tag` REGEXP ? OR `item`.`tag` REGEXP ?)",
- local_user(), public_contact(), $myUrl . '\\]', $diaspUrl . '\\]'];
+ $condition = ["NOT `wall` AND `uid` = ? AND `author-id` = ?", local_user(), public_contact()];
if (!$seen) {
$condition[0] .= " AND `unseen`";
$formattedNotifications = [];
try {
- $items = Item::selectForUser(local_user(), $fields, $condition, $params);
+ $items = Post::selectForUser(local_user(), $fields, $condition, $params);
while ($item = $this->dba->fetch($items)) {
$formattedNotifications[] = $this->createFromItem($item);
$formattedNotifications = [];
try {
- $items = Item::selectForUser(local_user(), $fields, $condition, $params);
+ $items = Post::selectForUser(local_user(), $fields, $condition, $params);
while ($item = $this->dba->fetch($items)) {
$item = $this->formatItem($item);