aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-07-26 07:16:06 +0000
committerMario <mario@mariovavti.com>2020-07-26 07:16:06 +0000
commitfba64e9451dcc4831b83161ab77301db551f8c17 (patch)
treede76a2e22d424025ad02ee9e5d8749081e1784ad /Zotlabs/Lib
parent9b5e270379bc2301f3edde2290525e3b546fa049 (diff)
downloadvolse-hubzilla-fba64e9451dcc4831b83161ab77301db551f8c17.tar.gz
volse-hubzilla-fba64e9451dcc4831b83161ab77301db551f8c17.tar.bz2
volse-hubzilla-fba64e9451dcc4831b83161ab77301db551f8c17.zip
improve profile detection and reduce feed result set
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Activity.php33
1 files changed, 29 insertions, 4 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index b8432f95a..25f19510d 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -1456,11 +1456,35 @@ class Activity {
$icon = $person_obj['icon'];
}
- if(is_array($person_obj['url']) && array_key_exists('href', $person_obj['url']))
- $profile = $person_obj['url']['href'];
- else
- $profile = $url;
+ $links = false;
+ $profile = false;
+
+ if (is_array($person_obj['url'])) {
+ if (! array_key_exists(0,$person_obj['url'])) {
+ $links = [ $person_obj['url'] ];
+ }
+ else {
+ $links = $person_obj['url'];
+ }
+ }
+
+ if ($links) {
+ foreach ($links as $link) {
+ if (array_key_exists('mediaType',$link) && $link['mediaType'] === 'text/html') {
+ $profile = $link['href'];
+ }
+ }
+ if (! $profile) {
+ $profile = $links[0]['href'];
+ }
+ }
+ elseif (isset($person_obj['url']) && is_string($person_obj['url'])) {
+ $profile = $person_obj['url'];
+ }
+ if (! $profile) {
+ $profile = $url;
+ }
$inbox = $person_obj['inbox'];
@@ -1492,6 +1516,7 @@ class Activity {
);
if(! $r) {
// create a new record
+
$r = xchan_store_lowlevel(
[
'xchan_hash' => $url,