diff options
author | friendica <info@friendica.com> | 2013-02-14 20:17:30 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-02-14 20:17:30 -0800 |
commit | b3bc061ae1108510b2bbc8363e8d4e7ee7add773 (patch) | |
tree | 64f33133f035e249bd1e4dd9c0c015dd80a90a08 | |
parent | 9784536ff90d2bda997088fd05c39247e44f52b4 (diff) | |
download | volse-hubzilla-b3bc061ae1108510b2bbc8363e8d4e7ee7add773.tar.gz volse-hubzilla-b3bc061ae1108510b2bbc8363e8d4e7ee7add773.tar.bz2 volse-hubzilla-b3bc061ae1108510b2bbc8363e8d4e7ee7add773.zip |
implement sender side of public scope setting (public post, network-wide, site-wide, etc....)
-rwxr-xr-x | include/items.php | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/include/items.php b/include/items.php index 114780135..bd52b8998 100755 --- a/include/items.php +++ b/include/items.php @@ -564,6 +564,18 @@ function encode_item($item) { logger('encode_item: ' . print_r($item,true)); + $r = q("select channel_r_stream from channel where channel_id = %d limit 1", + intval($item['uid']) + ); + + if($r) + $public_scope = $r[0]['channel_r_stream']; + else + $public_scope = 0; + + $scope = map_scope($public_scope); + + if($item['item_restrict'] & ITEM_DELETED) { $x['message_id'] = $item['uri']; $x['created'] = $item['created']; @@ -600,6 +612,10 @@ function encode_item($item) { $x['attach'] = json_decode($item['attach'],true); if($y = encode_item_flags($item)) $x['flags'] = $y; + + if(! in_array($y,'private')) + $x['public_scope'] = $scope; + if($item['term']) $x['tags'] = encode_item_terms($item['term']); @@ -607,6 +623,23 @@ function encode_item($item) { } + +function map_scope($scope) { + switch($scope) { + case PERMS_PUBLIC: + return 'public'; + case PERMS_NETWORK: + return 'network: red'; + case PERMS_SITE: + return 'site: ' . get_app()->get_hostname(); + case PERMS_CONTACTS: + default: + return 'contacts'; + } +} + + + function encode_item_xchan($xchan) { $ret = array(); @@ -1554,8 +1587,9 @@ function send_status_notifications($post_id,$item) { foreach($x as $xx) { if($xx['author_xchan'] === $r[0]['channel_hash']) { $notify = true; - if($xx['id'] == $xx['parent']) - $parent = $xx['parent']; + } + if($xx['id'] == $xx['parent']) { + $parent = $xx['parent']; } } } |