]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Merge pull request #4459 from annando/unmark-contact
[friendica.git] / src / Model / Item.php
index 30fc4ecef9e1a90575be5c9b867c86405a62ffcc..cc5449a99d942c1c59ff3fd1f20f799dca511f57 100644 (file)
@@ -1084,17 +1084,15 @@ class Item extends BaseObject
        private static function updateContact($arr)
        {
                // Unarchive the author
-               $contact = dba::selectFirst('contact', [], ['id' => $arr["author-link"]]);
-               if ($contact['term-date'] > NULL_DATE) {
-                        Contact::unmarkForArchival($contact);
+               $contact = dba::selectFirst('contact', [], ['id' => $arr["author-id"]]);
+               if (DBM::is_result($contact)) {
+                       Contact::unmarkForArchival($contact);
                }
 
-               // Unarchive the contact if it is a toplevel posting
-               if ($arr["parent-uri"] === $arr["uri"]) {
-                       $contact = dba::selectFirst('contact', [], ['id' => $arr["contact-id"]]);
-                       if ($contact['term-date'] > NULL_DATE) {
-                                Contact::unmarkForArchival($contact);
-                       }
+               // Unarchive the contact if it's not our own contact
+               $contact = dba::selectFirst('contact', [], ['id' => $arr["contact-id"], 'self' => false]);
+               if (DBM::is_result($contact)) {
+                       Contact::unmarkForArchival($contact);
                }
 
                $update = (!$arr['private'] && (($arr["author-link"] === $arr["owner-link"]) || ($arr["parent-uri"] === $arr["uri"])));