From 764ee785f5505c2be804a850b8e4029598d81739 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 16 Jun 2013 19:14:01 -0700 Subject: We will need a per item comment policy to be able to determine in advance if we have permission to comment on something , and we'll need to send it out with all communications. The current check is not only flawed but also a huge performance hit. Also provide the ability for an item to disable commenting completely - such as for a webpage or wherever you want to prevent comments on one item, without requiring a change to your entire permission scheme. All of this is only partially implemented at the moment but we need the structures in place on several sites in order to finish it without breaking everything. --- include/items.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 64eeae4b4..9d93accfe 100755 --- a/include/items.php +++ b/include/items.php @@ -549,13 +549,17 @@ function encode_item($item) { intval($item['uid']) ); - if($r) + if($r) { $public_scope = $r[0]['channel_r_stream']; - else + $comment_scope = $r[0]['channel_w_comment']; + } + else { $public_scope = 0; + $comment_scope = 0; + } $scope = map_scope($public_scope); - + $c_scope = map_scope($comment_scope); if($item['item_restrict'] & ITEM_DELETED) { $x['message_id'] = $item['mid']; @@ -597,6 +601,11 @@ function encode_item($item) { if(! in_array('private',$y)) $x['public_scope'] = $scope; + if($item['item_flags'] & ITEM_NOCOMMENT) + $x['comment_scope'] = 'none'; + else + $x['comment_scope'] = $c_scope; + if($item['term']) $x['tags'] = encode_item_terms($item['term']); -- cgit v1.2.3