Sync private items with clones; avoid sync if no local connection with thread owner
This commit is contained in:
@@ -769,7 +769,24 @@ function import_items($channel, $items, $sync = false, $relocate = null) {
|
||||
* @param array $relocate default null
|
||||
*/
|
||||
function sync_items($channel, $items, $relocate = null) {
|
||||
import_items($channel, $items, true, $relocate);
|
||||
|
||||
// Check if this is sync of not Zot-related content and we're connected to the top post owner
|
||||
// to avoid confusing with cloned channels
|
||||
$size = count($items);
|
||||
for($i = 0; $i < $size; $i++) {
|
||||
if(($items[$i]['owner']['network'] != 'zot') && ($items[$i]['owner']['network'] != 'zot6')) {
|
||||
$r = q("SELECT * FROM abook WHERE abook_channel = %d
|
||||
AND abook_xchan = ( SELECT xchan_hash FROM xchan WHERE xchan_guid = '%s' LIMIT 1 )
|
||||
AND abook_not_here = 0 AND abook_ignored = 0 AND abook_blocked = 0",
|
||||
intval($channel['channel_id']),
|
||||
dbesc($items[$i]['owner']['guid'])
|
||||
);
|
||||
if(! $r)
|
||||
unset($items[$i]);
|
||||
}
|
||||
}
|
||||
if(count($items) > 0)
|
||||
import_items($channel, $items, true, $relocate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user