aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-11 19:35:48 +0000
committerMario <mario@mariovavti.com>2020-10-11 19:35:48 +0000
commit4d2507263dbeba3b945efab5f3fcfc676558ded1 (patch)
treeeef83a5b6c47056f2493da83c81a39d4f6cdd0c3 /Zotlabs
parent4a671fe634a4a8463703dd661a238f5545f5a5e4 (diff)
downloadvolse-hubzilla-4d2507263dbeba3b945efab5f3fcfc676558ded1.tar.gz
volse-hubzilla-4d2507263dbeba3b945efab5f3fcfc676558ded1.tar.bz2
volse-hubzilla-4d2507263dbeba3b945efab5f3fcfc676558ded1.zip
find best identity
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Activity.php32
-rw-r--r--Zotlabs/Lib/Libzot.php5
2 files changed, 37 insertions, 0 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index af7d945ba..f3885033b 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -1736,6 +1736,23 @@ class Activity {
$s['aid'] = $channel['channel_account_id'];
$s['uid'] = $channel['channel_id'];
+
+ // Make sure we use the zot6 identity where applicable
+
+ $s['author_xchan'] = self::find_best_identity($s['author_xchan']);
+ $s['owner_xchan'] = self::find_best_identity($s['owner_xchan']);
+
+ if(!$s['author_xchan']) {
+ logger('No author: ' . print_r($act, true));
+ }
+
+ if(!$s['owner_xchan']) {
+ logger('No owner: ' . print_r($act, true));
+ }
+
+ if(!$s['author_xchan'] || !$s['owner_xchan'])
+ return;
+
$s['mid'] = urldecode($act->obj['id']);
$s['uuid'] = $act->obj['diaspora:guid'];
$s['plink'] = urldecode($act->obj['id']);
@@ -2477,6 +2494,11 @@ class Activity {
$item['aid'] = $channel['channel_account_id'];
$item['uid'] = $channel['channel_id'];
+ // Make sure we use the zot6 identity where applicable
+
+ $item['author_xchan'] = self::find_best_identity($item['author_xchan']);
+ $item['owner_xchan'] = self::find_best_identity($item['owner_xchan']);
+
if(! ( $item['author_xchan'] && $item['owner_xchan'])) {
logger('owner or author missing.');
return;
@@ -3162,5 +3184,15 @@ class Activity {
return $auth;
}
+ static function find_best_identity($xchan) {
+ $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s'",
+ dbesc($xchan)
+ );
+ if ($r) {
+ $r = Libzot::zot_record_preferred($r);
+ return $r['hubloc_hash'];
+ }
+ return $xchan;
+ }
}
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 44f1f399e..fb64626d6 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1467,6 +1467,11 @@ class Libzot {
$result = [];
+ // Make sure we use the zot6 identity where applicable
+
+ $msg_arr['author_xchan'] = Activity::find_best_identity($msg_arr['author_xchan']);
+ $msg_arr['owner_xchan'] = Activity::find_best_identity($msg_arr['owner_xchan']);
+
// We've validated the sender. Now make sure that the sender is the owner or author
if(! $public) {