From af0b4a0fca36cf8f52e1ef5f569dfb9268d92905 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 24 May 2023 09:08:32 +0000 Subject: return hubloc_hash instead of hubloc_id_url for AP and improved check for location --- Zotlabs/Lib/Activity.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index ced361fe5..c2acff83f 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -841,7 +841,7 @@ class Activity { if (isset($i['app']) && $i['app']) { $ret['generator'] = ['type' => 'Application', 'name' => $i['app']]; } - if (isset($i['location']) || isset($i['coord'])) { + if (!empty($i['location']) || !empty($i['coord'])) { $ret['location'] = ['type' => 'Place']; if ($i['location']) { $ret['location']['name'] = $i['location']; @@ -929,7 +929,6 @@ class Activity { ]; call_hooks('encode_activity', $hookinfo); - return $hookinfo['encoded']; } @@ -974,10 +973,14 @@ class Activity { $tmp = expand_acl($i['allow_cid']); $list = stringify_array($tmp, true); if ($list) { - $details = q("select hubloc_id_url from hubloc where hubloc_hash in (" . $list . ") and hubloc_id_url != '' and hubloc_deleted = 0"); + $details = q("select hubloc_id_url, hubloc_hash, hubloc_network from hubloc where hubloc_hash in (" . $list . ") and hubloc_id_url != '' and hubloc_deleted = 0"); if ($details) { foreach ($details as $d) { - $ret[] = $d['hubloc_id_url']; + if ($d['hubloc_network'] === 'activitypub') { + $ret[] = $d['hubloc_hash']; + } else { + $ret[] = $d['hubloc_id_url']; + } } } } -- cgit v1.2.3