function visible_activity($item) {
- if(activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE))
- return false;
+ // likes (etc.) can apply to other things besides posts. Check if they are post children,
+ // in which case we handle them specially
+
+ $hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN);
+ foreach($hidden_activities as $act) {
+ if(activity_match($item['verb'],$act)) {
+ return false;
+ }
+ }
if(activity_match($item['verb'],ACTIVITY_FOLLOW) && $item['object-type'] === ACTIVITY_OBJ_NOTE) {
if(! (($item['self']) && ($item['uid'] == local_user()))) {
$cmnt_tpl = get_markup_template('comment_item.tpl');
$hide_comments_tpl = get_markup_template('hide_comments.tpl');
- $alike = array();
- $dlike = array();
+ $conv_responses = array(array('like'),array('dislike'),array('agree'),array('disagree'),array('abstain'));
// array with html for each thread (parent+comments)
$threads = array();
// Can we put this after the visibility check?
- like_puller($a,$item,$alike,'like');
- like_puller($a,$item,$dlike,'dislike');
+ like_puller($a, $item, $conv_responses, 'like');
+ like_puller($a, $item, $conv_responses, 'dislike');
+ like_puller($a, $item, $conv_responses, 'agree');
+ like_puller($a, $item, $conv_responses, 'disagree');
+ like_puller($a, $item, $conv_responses, 'abstain');
// Only add what is visible
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
}
}
- $threads = $conv->get_template_data($alike, $dlike);
+ $threads = $conv->get_template_data($conv_responses);
if(!$threads) {
logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
$url = '';
$sparkle = '';
- $verb = (($mode === 'like') ? ACTIVITY_LIKE : ACTIVITY_DISLIKE);
+ switch($mode) {
+ case 'like':
+ case 'unlike':
+ $verb = ACTIVITY_LIKE;
+ break;
+ case 'dislike':
+ case 'undislike':
+ $verb = ACTIVITY_DISLIKE;
+ break;
+ case 'agree':
+ case 'unagree':
+ $verb = ACTIVITY_AGREE;
+ break;
+ case 'disagree':
+ case 'undisagree':
+ $verb = ACTIVITY_DISAGREE;
+ break;
+ case 'abstain':
+ case 'unabstain':
+ $verb = ACTIVITY_ABSTAIN;
+ break;
+ default:
+ return;
+ break;
+ }
if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
$url = $item['author-link'];
if(! $item['thr-parent'])
$item['thr-parent'] = $item['parent-uri'];
- if(! ((isset($arr[$item['thr-parent'] . '-l'])) && (is_array($arr[$item['thr-parent'] . '-l']))))
- $arr[$item['thr-parent'] . '-l'] = array();
- if(! isset($arr[$item['thr-parent']]))
- $arr[$item['thr-parent']] = 1;
+ if(! ((isset($arr[$mode][$item['thr-parent'] . '-l'])) && (is_array($arr[$item['thr-parent'] . '-l']))))
+ $arr[$mode][$item['thr-parent'] . '-l'] = array();
+ if(! isset($arr[$mode][$item['thr-parent']]))
+ $arr[$mode][$item['thr-parent']] = 1;
else
- $arr[$item['thr-parent']] ++;
- $arr[$item['thr-parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
+ $arr[$mode][$item['thr-parent']] ++;
+
+ $arr[$mode][$item['thr-parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
}
return;
}}
* _ The data requested on success
* _ false on failure
*/
- public function get_template_data($alike, $dlike, $thread_level=1) {
+ public function get_template_data($conv_responses, $thread_level=1) {
require_once("mod/proxy.php");
$result = array();
}
}*/
- $like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
- $dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
+ $like = ((x($conv_responses['like'],$item['uri'])) ? format_like($conv_responses['like'][$item['uri']],$conv_responses['like'][$item['uri'] . '-l'],'like',$item['uri']) : '');
+ $dislike = ((x($conv_responses['dislike'],$item['uri'])) ? format_like($conv_responses['dislike'][$item['uri']],$conv_responses['dislike'][$item['uri'] . '-l'],'dislike',$item['uri']) : '');
/*
* We should avoid doing this all the time, but it depends on the conversation mode
$nb_children = count($children);
if($nb_children > 0) {
foreach($children as $child) {
- $result['children'][] = $child->get_template_data($alike, $dlike, $thread_level + 1);
+ $result['children'][] = $child->get_template_data($conv_responses, $thread_level + 1);
}
// Collapse
if(($nb_children > 2) || ($thread_level > 1)) {