diff options
author | friendica <info@friendica.com> | 2014-10-22 20:39:49 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-10-22 20:39:49 -0700 |
commit | 58c692e3897a7807fed23e2633496c4960f022ca (patch) | |
tree | 38311cf84fc526f5a52cf2200f943b3590d0eba9 /mod/item.php | |
parent | 902b5c52e5ca9359522f33bbecaf7f2f3c1ba90d (diff) | |
download | volse-hubzilla-58c692e3897a7807fed23e2633496c4960f022ca.tar.gz volse-hubzilla-58c692e3897a7807fed23e2633496c4960f022ca.tar.bz2 volse-hubzilla-58c692e3897a7807fed23e2633496c4960f022ca.zip |
improved wall-to-wall detection for comments so we can handle Diaspora signing and wall-to-wall attribution correctly.
Do it at the point of submission. This also fixes a potential bug in yesterday's wall-to-wall permission setting,
if it was a local comment to a remote post.
Diffstat (limited to 'mod/item.php')
-rw-r--r-- | mod/item.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/mod/item.php b/mod/item.php index 589e3beb1..ad567b21f 100644 --- a/mod/item.php +++ b/mod/item.php @@ -258,15 +258,26 @@ function item_post(&$a) { } $walltowall = false; + $walltowall_comment = false; if($observer) { logger('mod_item: post accepted from ' . $observer['xchan_name'] . ' for ' . $owner_xchan['xchan_name'], LOGGER_DEBUG); - if($observer['xchan_name'] != $owner_xchan['xchan_name']) - $walltowall = true; - } - + // wall-to-wall detection. + // For top-level posts, if the author and owner are different it's a wall-to-wall + // For comments, We need to additionally look at the parent and see if it's a wall post that originated locally. + if($observer['xchan_name'] != $owner_xchan['xchan_name']) { + if($parent_item && ($parent_item['item_flags'] & (ITEM_WALL|ITEM_ORIGIN)) == (ITEM_WALL|ITEM_ORIGIN)) { + $walltowall_comment = true; + $walltowall = true; + } + if(! $parent) { + $walltowall = true; + } + } + } + $public_policy = ((x($_REQUEST,'public_policy')) ? escape_tags($_REQUEST['public_policy']) : map_scope($channel['channel_r_stream'],true)); if($webpage) $public_policy = ''; @@ -874,10 +885,9 @@ function item_post(&$a) { if($parent) { // Store the comment signature information in case we need to relay to Diaspora -//FIXME $ditem = $datarray; $ditem['author'] = $observer; - store_diaspora_comment_sig($ditem,$channel,$parent_item, $post_id); + 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); |