aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-08-16 08:50:52 +0200
committerMario Vavti <mario@mariovavti.com>2018-08-16 08:50:52 +0200
commite25db4d1b57116353ad4e4909eb93824a673ffb3 (patch)
tree8ad9f1cb5f1934ab7593fb8bb291c6d398153a1f /include
parent2becc3273aa377574d566c052036f425105b2389 (diff)
parent32acb0ff01b8fde3801fafbd7953aa36b5933f96 (diff)
downloadvolse-hubzilla-e25db4d1b57116353ad4e4909eb93824a673ffb3.tar.gz
volse-hubzilla-e25db4d1b57116353ad4e4909eb93824a673ffb3.tar.bz2
volse-hubzilla-e25db4d1b57116353ad4e4909eb93824a673ffb3.zip
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php40
1 files changed, 27 insertions, 13 deletions
diff --git a/include/items.php b/include/items.php
index 9dd5d005b..ee7bfd5bc 100755
--- a/include/items.php
+++ b/include/items.php
@@ -234,10 +234,11 @@ function can_comment_on_post($observer_xchan, $item) {
// logger('Comment_policy: ' . $item['comment_policy'], LOGGER_DEBUG);
$x = [
- 'observer_hash' => $observer_xchan,
- 'item' => $item,
- 'allowed' => 'unset'
+ 'observer_hash' => $observer_xchan,
+ 'item' => $item,
+ 'allowed' => 'unset'
];
+
/**
* @hooks can_comment_on_post
* Called when deciding whether or not to present a comment box for a post.
@@ -245,26 +246,34 @@ function can_comment_on_post($observer_xchan, $item) {
* * \e array \b item
* * \e boolean \b allowed - return value
*/
+
call_hooks('can_comment_on_post', $x);
- if($x['allowed'] !== 'unset')
+
+ if($x['allowed'] !== 'unset') {
return $x['allowed'];
+ }
- if(! $observer_xchan)
+ if(! $observer_xchan) {
return false;
+ }
- if($item['comment_policy'] === 'none')
+ if($item['comment_policy'] === 'none') {
return false;
+ }
- if(comments_are_now_closed($item))
+ if(comments_are_now_closed($item)) {
return false;
+ }
- if($observer_xchan === $item['author_xchan'] || $observer_xchan === $item['owner_xchan'])
+ if($observer_xchan === $item['author_xchan'] || $observer_xchan === $item['owner_xchan']) {
return true;
+ }
switch($item['comment_policy']) {
case 'self':
- if($observer_xchan === $item['author_xchan'] || $observer_xchan === $item['owner_xchan'])
+ if($observer_xchan === $item['author_xchan'] || $observer_xchan === $item['owner_xchan']) {
return true;
+ }
break;
case 'public':
case 'authenticated':
@@ -276,17 +285,22 @@ function can_comment_on_post($observer_xchan, $item) {
case 'any connections':
case 'contacts':
case '':
- if(array_key_exists('owner',$item) && get_abconfig($item['uid'],$item['owner']['abook_xchan'],'their_perms','post_comments')) {
- return true;
+ if(local_channel() && get_abconfig(local_channel(),$item['owner_xchan'],'their_perms','post_comments')) {
+ return true;
+ }
+ if(intval($item['item_wall']) && perm_is_allowed($item['uid'],$observer_xchan,'post_comments')) {
+ return true;
}
break;
default:
break;
}
- if(strstr($item['comment_policy'],'network:') && strstr($item['comment_policy'],'red'))
+ if(strstr($item['comment_policy'],'network:') && strstr($item['comment_policy'],'red')) {
return true;
- if(strstr($item['comment_policy'],'site:') && strstr($item['comment_policy'],App::get_hostname()))
+ }
+ if(strstr($item['comment_policy'],'site:') && strstr($item['comment_policy'],App::get_hostname())) {
return true;
+ }
return false;
}