Merge branch 'dev' into 'dev'
fetch private objects using delivery channel credentials See merge request hubzilla/core!1545
This commit is contained in:
commit
c0b238b19a
@ -1125,9 +1125,14 @@ class Libzot {
|
||||
logger('Activity rejected: ' . print_r($data,true));
|
||||
return;
|
||||
}
|
||||
$arr = Activity::decode_note($AS);
|
||||
if (is_array($AS->obj)) {
|
||||
$arr = Activity::decode_note($AS);
|
||||
}
|
||||
else {
|
||||
$arr = [];
|
||||
}
|
||||
|
||||
logger($AS->debug());
|
||||
logger($AS->debug(),LOGGER_DATA);
|
||||
}
|
||||
|
||||
|
||||
@ -1230,7 +1235,7 @@ class Libzot {
|
||||
|
||||
$relay = (($env['type'] === 'response') ? true : false );
|
||||
|
||||
$result = self::process_delivery($env['sender'],$arr,$deliveries,$relay,false,$message_request);
|
||||
$result = self::process_delivery($env['sender'],$AS,$arr,$deliveries,$relay,false,$message_request);
|
||||
}
|
||||
elseif($env['type'] === 'sync') {
|
||||
// $arr = get_channelsync_elements($data);
|
||||
@ -1412,7 +1417,7 @@ class Libzot {
|
||||
* @return array
|
||||
*/
|
||||
|
||||
static function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $request = false) {
|
||||
static function process_delivery($sender, $act, $arr, $deliveries, $relay, $public = false, $request = false) {
|
||||
|
||||
$result = [];
|
||||
|
||||
@ -1441,6 +1446,24 @@ 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.
|
||||
// Try again using the delivery channel credentials.
|
||||
// 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);
|
||||
if($o) {
|
||||
$act->obj = $o;
|
||||
$arr = array_merge(Activity::decode_note($act),$arr);
|
||||
}
|
||||
else {
|
||||
$DR->update('Incomplete or corrupt activity');
|
||||
$result[] = $DR->get();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to block normal top-level message delivery from our clones, as the delivered
|
||||
* message doesn't have ACL information in it as the cloned copy does. That copy
|
||||
@ -1859,7 +1882,7 @@ class Libzot {
|
||||
logger('FOF Activity received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
|
||||
logger('FOF Activity recipient: ' . $channel['channel_portable_id'], LOGGER_DATA, LOG_DEBUG);
|
||||
|
||||
$result = self::process_delivery($arr['owner_xchan'],$arr, [ $channel['channel_portable_id'] ],false,false,true);
|
||||
$result = self::process_delivery($arr['owner_xchan'],$AS, $arr, [ $channel['channel_portable_id'] ],false,false,true);
|
||||
if ($result) {
|
||||
$ret = array_merge($ret, $result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user