From 9fa0490c4494b4c01f6b2bb84cb0915562127fe4 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 7 Sep 2015 18:11:30 -0700 Subject: sync posted top level items rather than deliver them (actually we do both, but sync comes first). This way we get the ACL transferred. --- mod/item.php | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index bc2710b42..bff312cfe 100644 --- a/mod/item.php +++ b/mod/item.php @@ -823,6 +823,19 @@ function item_post(&$a) { update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid); + if(! $parent) { + $r = q("select * from item where id = %d", + intval($post_id) + ); + if($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + $rid = q("select * from item_id where iid = %d", + intval($post_id) + ); + build_sync_packet($uid,array('item' => array(encode_item($sync_item[0],true)),'item_id' => $rid)); + } + } if(! $nopush) proc_run('php', "include/notifier.php", 'edit_post', $post_id); @@ -903,14 +916,28 @@ function item_post(&$a) { // NOTREACHED } - if($parent) { + + update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid); + + 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)); } - - update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid); + else { + $r = q("select * from item where id = %d", + intval($post_id) + ); + if($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + $rid = q("select * from item_id where iid = %d", + intval($post_id) + ); + build_sync_packet($uid,array('item' => array(encode_item($sync_item[0],true)),'item_id' => $rid)); + } + } $datarray['id'] = $post_id; $datarray['llink'] = $a->get_baseurl() . '/display/' . $channel['channel_address'] . '/' . $post_id; -- cgit v1.2.3