]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Contact.php
We now store the causer-id in the items
[friendica.git] / src / Model / Contact.php
index c5df814bf68014b1f48fb6eaa9225b8cb35201c6..3d3583b6bf70ad915ab80b1d7e817a27f7687b11 100644 (file)
@@ -1802,7 +1802,7 @@ class Contact
                // These fields aren't updated by this routine:
                // 'xmpp', 'sensitive'
 
-               $fields = ['uid', 'avatar', 'name', 'nick', 'location', 'keywords', 'about', 'subscribe',
+               $fields = ['uid', 'avatar', 'name', 'nick', 'location', 'keywords', 'about', 'subscribe', 'manually-approve',
                        'unsearchable', 'url', 'addr', 'batch', 'notify', 'poll', 'request', 'confirm', 'poco',
                        'network', 'alias', 'baseurl', 'gsid', 'forum', 'prv', 'contact-type', 'pubkey', 'last-item'];
                $contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
@@ -1850,12 +1850,9 @@ class Contact
                        $ret['forum'] = false;
                        $ret['prv'] = false;
                        $ret['contact-type'] = $ret['account-type'];
-                       if ($ret['contact-type'] == User::ACCOUNT_TYPE_COMMUNITY) {
-                               $apcontact = APContact::getByURL($ret['url'], false);
-                               if (isset($apcontact['manually-approve'])) {
-                                       $ret['forum'] = (bool)!$apcontact['manually-approve'];
-                                       $ret['prv'] = (bool)!$ret['forum'];
-                               }
+                       if (($ret['contact-type'] == User::ACCOUNT_TYPE_COMMUNITY) && isset($ret['manually-approve'])) {
+                               $ret['forum'] = (bool)!$ret['manually-approve'];
+                               $ret['prv'] = (bool)!$ret['forum'];
                        }
                }
 
@@ -1912,7 +1909,7 @@ class Contact
                        $ret['pubkey'] = $new_pubkey;
                }
 
-               if (($ret['addr'] != $contact['addr']) || (!empty($ret['alias']) && ($ret['alias'] != $contact['alias']))) {
+               if ((!empty($ret['addr']) && ($ret['addr'] != $contact['addr'])) || (!empty($ret['alias']) && ($ret['alias'] != $contact['alias']))) {
                        $ret['uri-date'] = DateTimeFormat::utcNow();
                }
 
@@ -2088,7 +2085,7 @@ class Contact
                }
 
                // do we have enough information?
-               if (empty($ret['name']) || empty($ret['poll']) || (empty($ret['url']) && empty($ret['addr']))) {
+               if (empty($protocol) || ($protocol == Protocol::PHANTOM) || (empty($ret['url']) && empty($ret['addr']))) {
                        $result['message'] .= DI::l10n()->t('The profile address specified does not provide adequate information.') . EOL;
                        if (empty($ret['poll'])) {
                                $result['message'] .= DI::l10n()->t('No compatible communication protocols or feeds were discovered.') . EOL;
@@ -2122,11 +2119,8 @@ class Contact
                $hidden = (($protocol === Protocol::MAIL) ? 1 : 0);
 
                $pending = false;
-               if ($protocol == Protocol::ACTIVITYPUB) {
-                       $apcontact = APContact::getByURL($ret['url'], false);
-                       if (isset($apcontact['manually-approve'])) {
-                               $pending = (bool)$apcontact['manually-approve'];
-                       }
+               if (($protocol == Protocol::ACTIVITYPUB) && isset($ret['manually-approve'])) {
+                       $pending = (bool)$ret['manually-approve'];
                }
 
                if (in_array($protocol, [Protocol::MAIL, Protocol::DIASPORA, Protocol::ACTIVITYPUB])) {