From 06aa3e6b8ca66e6bcd06cb4f5bab922d40f83a16 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 15 Dec 2020 11:29:45 +0000 Subject: fix issue with abconfig when cloning a channel (cherry picked from commit f13bff2a767cf3a575698f55dad978c7a4cc1a72) --- Zotlabs/Lib/Libzot.php | 12 ++++++------ include/channel.php | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index f0fe3ab24..972ebe0e9 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1489,9 +1489,9 @@ class Libzot { $DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>'); if(($act) && ($act->obj) && (! is_array($act->obj))) { - // The initial object fetch failed using the sys channel credentials. + // The initial object fetch failed using the sys channel credentials. // Try again using the delivery channel credentials. - // We will also need to re-parse the $item array, + // We will also need to re-parse the $item array, // but preserve any values that were set during anonymous parsing. $o = Activity::fetch($act->obj,$channel); @@ -1505,7 +1505,7 @@ class Libzot { $result[] = $DR->get(); continue; } - } + } /** * We need to block normal top-level message delivery from our clones, as the delivered @@ -1634,7 +1634,7 @@ class Libzot { // have the copy and we don't want the request to loop. // Also don't do this if this comment came from a conversation request packet. // It's possible that comments are allowed but posting isn't and that could - // cause a conversation fetch loop. + // cause a conversation fetch loop. // We'll also check the send_stream permission - because if it isn't allowed, // the top level post is unlikely to be imported and // this is just an exercise in futility. @@ -2295,7 +2295,7 @@ class Libzot { * * @see import_directory_profile() * - * @param string $sender + * @param string $sender * @param array $arr * @param array $deliveries (unused) * @return void @@ -2316,7 +2316,7 @@ class Libzot { /** * @brief * - * @param string $sender + * @param string $sender * @param array $arr * @param array $deliveries (unused) deliveries is irrelevant * @return void diff --git a/include/channel.php b/include/channel.php index 88b8c2ceb..d610a0b9a 100644 --- a/include/channel.php +++ b/include/channel.php @@ -935,6 +935,16 @@ function identity_basic_export($channel_id, $sections = null, $zap_compat = fals $their_perms = []; $newconfig = []; $abconfig = load_abconfig($channel_id,$ret['abook'][$x]['abook_xchan']); + + // Partly revert of commit 85cf25a2a8bfbbfe10de485d4affd54626fbbfa4 + if($abconfig) { + $ret['abook'][$x]['abconfig'] = $abconfig; + } + + /* This was added in commit 85cf25a2a8bfbbfe10de485d4affd54626fbbfa4 + * Seems unfinished work on zap compatibility for cloning. + * It breaks cloning of abconfig for hubzilla - reverted to the above code. + if($abconfig) { foreach ($abconfig as $abc) { @@ -953,17 +963,21 @@ function identity_basic_export($channel_id, $sections = null, $zap_compat = fals } $ret['abook'][$x]['abconfig'] = $newconfig; + if ($zap_compat) { $ret['abook'][$x]['abconfig'][] = [ 'chan' => $channel_id, 'xchan' => $ret['abook'][$x]['abook_chan'], 'cat' => 'system', 'k' => 'my_perms', 'v' => implode(',',$my_perms) ]; $ret['abook'][$x]['abconfig'][] = [ 'chan' => $channel_id, 'xchan' => $ret['abook'][$x]['abook_chan'], 'cat' => 'system', 'k' => 'their_perms', 'v' => implode(',',$their_perms) ]; } } + */ translate_abook_perms_outbound($ret['abook'][$x]); } - // pick up the zot6 xchan and hublocs also + + + // pick up the zot xchan and hublocs also if($ret['channel']['channel_portable_id']) { $xchans[] = $ret['channel']['channel_portable_id']; -- cgit v1.2.3