From e8bdf2b8d741354fd479bd5fc31f704e2c6f6c88 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 10 Feb 2015 21:21:18 -0800 Subject: more permissions tweaking --- include/ItemObject.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index ff7da2418..c429a0131 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -136,30 +136,40 @@ class Item extends BaseObject { $location = format_location($item); $isevent = false; $attend = null; + $canvote = false; // process action responses - e.g. like/dislike/attend/agree/whatever $response_verbs = array('like'); if(feature_enabled($conv->get_profile_owner(),'dislike')) $response_verbs[] = 'dislike'; - if($item['obj_type'] === ACTIVITY_OBJ_EVENT && $this->is_commentable()) { + if($item['obj_type'] === ACTIVITY_OBJ_EVENT) { $response_verbs[] = 'attendyes'; $response_verbs[] = 'attendno'; $response_verbs[] = 'attendmaybe'; - $isevent = true; - $attend = array( t('I will attend'), t('I will not attend'), t('I might attend')); + if($this->is_commentable()) { + $isevent = true; + $attend = array( t('I will attend'), t('I will not attend'), t('I might attend')); + } } - $consensus = ((($item['item_flags'] & ITEM_CONSENSUS) && $this->is_commentable()) ? true : false); + $consensus = (($item['item_flags'] & ITEM_CONSENSUS) ? true : false); if($consensus) { $response_verbs[] = 'agree'; $response_verbs[] = 'disagree'; $response_verbs[] = 'abstain'; - $conlabels = array( t('I agree'), t('I disagree'), t('I abstain')); + if($this->is_commentable()) { + $conlabels = array( t('I agree'), t('I disagree'), t('I abstain')); + $canvote = true; + } } + if(! feature_enabled($conv->get_profile_owner(),'dislike')) + unset($conv_responses['dislike']); + $responses = get_responses($conv_responses,$response_verbs,$this,$item); + $like_button_label = tt('Like','Likes',$like_count,'noun'); $like_count = ((x($conv_responses['like'],$item['mid'])) ? $conv_responses['like'][$item['mid']] : ''); @@ -284,6 +294,7 @@ class Item extends BaseObject { 'attend' => $attend, 'consensus' => $consensus, 'conlabels' => $conlabels, + 'canvote' => $canvote, 'linktitle' => sprintf( t('View %s\'s profile - %s'), $profile_name, $item['author']['xchan_addr']), 'olinktitle' => sprintf( t('View %s\'s profile - %s'), $this->get_owner_name(), $item['owner']['xchan_addr']), 'llink' => $item['llink'], -- cgit v1.2.3