aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-09-30 16:19:39 +0200
committerMario <mario@mariovavti.com>2019-09-30 16:19:39 +0200
commit407b9c9cd7ab3ef9ba77e6f719655354a7233920 (patch)
tree9fa6fc6e944b47a0ed80851b63df3fe00126f2a3
parentd0055310baf8d608af8fc72976bfeaa242273a04 (diff)
downloadvolse-hubzilla-407b9c9cd7ab3ef9ba77e6f719655354a7233920.tar.gz
volse-hubzilla-407b9c9cd7ab3ef9ba77e6f719655354a7233920.tar.bz2
volse-hubzilla-407b9c9cd7ab3ef9ba77e6f719655354a7233920.zip
Sync private items with clones; avoid sync if no local connection with thread owner
-rw-r--r--Zotlabs/Module/Item.php8
-rw-r--r--include/import.php19
2 files changed, 19 insertions, 8 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index d03b6ee30..cda8eabec 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -1232,13 +1232,7 @@ class Item extends Controller {
killme();
}
- if(($parent) && ($parent != $post_id)) {
- // Store the comment signature information in case we need to relay to Diaspora
- //$ditem = $datarray;
- //$ditem['author'] = $observer;
- //store_diaspora_comment_sig($ditem,$channel,$parent_item, $post_id, (($walltowall_comment) ? 1 : 0));
- }
- else {
+ if(($parent == $post_id) || ($datarray['item_private'] == 1)) {
$r = q("select * from item where id = %d",
intval($post_id)
);
diff --git a/include/import.php b/include/import.php
index d3e8f7091..6a3895b9f 100644
--- a/include/import.php
+++ b/include/import.php
@@ -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);
}
/**