<?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\DI;
use Friendica\Model\Contact;
use Friendica\Model\Mail;
-use Friendica\Model\Notify\Type;
use Friendica\Module\Security\Login;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
$messages = DBA::toArray($messages_stmt);
DBA::update('mail', ['seen' => 1], ['parent-uri' => $message['parent-uri'], 'uid' => local_user()]);
- DBA::update('notify', ['seen' => 1], ['type' => Type::MAIL, 'parent' => $message['id'], 'uid' => local_user()]);
} else {
$messages = false;
}
'id' => $message['id'],
'from_name' => $from_name_e,
'from_url' => $from_url,
- 'from_addr' => $contact['addr'],
+ 'from_addr' => $contact['addr'] ?? $from_url,
'sparkle' => $sparkle,
'from_photo' => $from_photo,
'subject' => $subject_e,
* @param int $limit
* @return array
*/
-function get_messages($uid, $start, $limit)
+function get_messages(int $uid, int $start, int $limit)
{
return DBA::toArray(DBA::p('SELECT
m.`id`,
$body_e = $rr['body'];
$to_name_e = $rr['name'];
+ if (is_null($rr['url'])) {
+ // contact-id is pointing to a non existing contact
+ continue;
+ }
+
$contact = Contact::getByURL($rr['url'], false, ['thumb', 'addr', 'id', 'avatar']);
$from_photo = Contact::getThumb($contact, $rr['thumb'] ?: $rr['from-photo']);