1
0
Fork 0

Merge pull request #11261 from annando/notices

Avoid warning and notice
This commit is contained in:
Tobias Diekershoff 2022-02-20 07:23:53 +01:00 committed by GitHub
commit 446775cdc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -200,11 +200,16 @@ class UserNotification
$profiles = self::getProfileForUser($uid); $profiles = self::getProfileForUser($uid);
// Fetch all contacts for the given profiles // Fetch all contacts for the given profiles
$contacts = []; $contacts = [];
$iscommunity = false;
$ret = DBA::select('contact', ['id'], ['uid' => 0, 'nurl' => $profiles]); $ret = DBA::select('contact', ['id', 'contact-type'], ['uid' => 0, 'nurl' => $profiles]);
while ($contact = DBA::fetch($ret)) { while ($contact = DBA::fetch($ret)) {
$contacts[] = $contact['id']; $contacts[] = $contact['id'];
if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) {
$iscommunity = true;
}
} }
DBA::close($ret); DBA::close($ret);
@ -237,7 +242,7 @@ class UserNotification
} }
} }
if (($contact['contact-type'] != Contact::TYPE_COMMUNITY) && self::checkDirectCommentedThread($item, $contacts)) { if (!$iscommunity && self::checkDirectCommentedThread($item, $contacts)) {
$notification_type = $notification_type | self::TYPE_DIRECT_THREAD_COMMENT; $notification_type = $notification_type | self::TYPE_DIRECT_THREAD_COMMENT;
if (!$notified) { if (!$notified) {
self::insertNotificationByItem(self::TYPE_DIRECT_THREAD_COMMENT, $uid, $item); self::insertNotificationByItem(self::TYPE_DIRECT_THREAD_COMMENT, $uid, $item);

View file

@ -1731,6 +1731,7 @@ class OStatus
if ($owner['contact-type'] == Contact::TYPE_COMMUNITY) { if ($owner['contact-type'] == Contact::TYPE_COMMUNITY) {
$contact = Contact::getByURL($item['author-link']) ?: $owner; $contact = Contact::getByURL($item['author-link']) ?: $owner;
$contact['nickname'] = $contact['nickname'] ?? $contact['nick'];
$author = self::addAuthor($doc, $contact, false); $author = self::addAuthor($doc, $contact, false);
$entry->appendChild($author); $entry->appendChild($author);
} }