]> git.mxchange.org Git - friendica.git/commitdiff
Avoid warning and notice
authorMichael <heluecht@pirati.ca>
Sun, 20 Feb 2022 05:14:36 +0000 (05:14 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 20 Feb 2022 05:14:36 +0000 (05:14 +0000)
src/Model/Post/UserNotification.php
src/Protocol/OStatus.php

index 604e8efe558c8182abf82b68fc0fdc2f629999d3..806dfe26e5bdfa000a4bf0833aca1e6b1532198a 100644 (file)
@@ -200,11 +200,16 @@ class UserNotification
                $profiles = self::getProfileForUser($uid);
 
                // 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)) {
                        $contacts[] = $contact['id'];
+
+                       if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) {
+                               $iscommunity = true;
+                       }
                }
                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;
                        if (!$notified) {
                                self::insertNotificationByItem(self::TYPE_DIRECT_THREAD_COMMENT, $uid, $item);
index 835dc4bde89b1ccd4574042728c64bae338a1b92..a2c9a84473ef33d888dda6f9a895ffbf3f8a0e90 100644 (file)
@@ -1731,6 +1731,7 @@ class OStatus
 
                        if ($owner['contact-type'] == Contact::TYPE_COMMUNITY) {
                                $contact = Contact::getByURL($item['author-link']) ?: $owner;
+                               $contact['nickname'] = $contact['nickname'] ?? $contact['nick']; 
                                $author = self::addAuthor($doc, $contact, false);
                                $entry->appendChild($author);
                        }