]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/APContact.php
Merge pull request #10350 from annando/api-notifications
[friendica.git] / src / Model / APContact.php
index d945c5e4edb23da6f50ea2fc4ba382de74e34c60..8795b22aa506f2e74d84c0373e00375bea21c509 100644 (file)
@@ -26,6 +26,7 @@ use Friendica\Core\Cache\Duration;
 use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
+use Friendica\Database\DBStructure;
 use Friendica\DI;
 use Friendica\Network\Probe;
 use Friendica\Protocol\ActivityNamespace;
@@ -192,7 +193,7 @@ class APContact
 
                $apcontact['sharedinbox'] = '';
                if (!empty($compacted['as:endpoints'])) {
-                       $apcontact['sharedinbox'] = JsonLD::fetchElement($compacted['as:endpoints'], 'as:sharedbox', '@id');
+                       $apcontact['sharedinbox'] = JsonLD::fetchElement($compacted['as:endpoints'], 'as:sharedInbox', '@id');
                        self::unarchiveInbox($apcontact['sharedinbox'], true);
                }
 
@@ -349,6 +350,9 @@ class APContact
                        DBA::delete('apcontact', ['url' => $url]);
                }
 
+               // Limit the length on incoming fields
+               $apcontact = DBStructure::getFieldsForTable('apcontact', $apcontact);
+
                if (DBA::exists('apcontact', ['url' => $apcontact['url']])) {
                        DBA::update('apcontact', $apcontact, ['url' => $apcontact['url']]);
                } else {
@@ -357,7 +361,7 @@ class APContact
 
                Logger::info('Updated profile', ['url' => $url]);
 
-               return $apcontact;
+               return DBA::selectFirst('apcontact', [], ['url' => $apcontact['url']]) ?: [];
        }
 
        /**