diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ItemObject.php | 21 | ||||
-rw-r--r-- | include/conversation.php | 3 |
2 files changed, 19 insertions, 5 deletions
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'], diff --git a/include/conversation.php b/include/conversation.php index 2c89249cb..addae3a9f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1038,6 +1038,7 @@ function builtin_activity_puller($item, &$conv_responses) { $conv_responses[$mode][$item['thr_parent'] . '-l'][] = $url; } } + } // Format the like/dislike text for a profile item @@ -1648,6 +1649,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){ function get_responses($conv_responses,$response_verbs,$ob,$item) { + $ret = array(); foreach($response_verbs as $v) { $ret[$v] = array(); @@ -1665,6 +1667,7 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) { $ret[$v]['title'] = $conv_responses[$v]['title']; } $ret['count'] = count($ret); +//logger('ret: ' . print_r($ret,true)); return $ret; } |