]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #4459 from annando/unmark-contact
authorHypolite Petovan <mrpetovan@gmail.com>
Wed, 14 Feb 2018 22:01:17 +0000 (17:01 -0500)
committerGitHub <noreply@github.com>
Wed, 14 Feb 2018 22:01:17 +0000 (17:01 -0500)
Bugfix and improvements for unmarking potentially archived contacts

1  2 
src/Model/Item.php

diff --combined src/Model/Item.php
index 30fc4ecef9e1a90575be5c9b867c86405a62ffcc,6f471ba4e981c02cf0c4ba5d8b63e3a509283a55..cc5449a99d942c1c59ff3fd1f20f799dca511f57
@@@ -251,8 -251,9 +251,8 @@@ class Item extends BaseObjec
                        $arr['network'] = trim(defaults($arr, 'network', NETWORK_PHANTOM));
                }
  
 -              if ($notify) {
 -                      $guid_prefix = "";
 -              } elseif ((trim($arr['guid']) == "") && (trim($arr['plink']) != "")) {
 +              $guid_prefix = '';
 +              if ((trim($arr['guid']) == "") && (trim($arr['plink']) != "")) {
                        $arr['guid'] = self::guidFromUri($arr['plink']);
                } elseif ((trim($arr['guid']) == "") && (trim($arr['uri']) != "")) {
                        $arr['guid'] = self::guidFromUri($arr['uri']);
  
                $arr['thr-parent'] = $arr['parent-uri'];
  
 +              $notify_type = '';
 +              $allow_cid = '';
 +              $allow_gid = '';
 +              $deny_cid  = '';
 +              $deny_gid  = '';
                if ($arr['parent-uri'] === $arr['uri']) {
                        $parent_id = 0;
                        $parent_deleted = 0;
        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"])));