]> git.mxchange.org Git - friendica.git/commitdiff
fixes like/dislike for photos
authorrabuzarus <>
Thu, 4 Jun 2015 02:19:06 +0000 (04:19 +0200)
committerrabuzarus <trebor@central-unit>
Wed, 30 Sep 2015 12:39:00 +0000 (14:39 +0200)
include/conversation.php
mod/photos.php
object/Item.php

index 4924470875a6ee14383809b0beca1758b1eafecf..0199bee5afa5ff154ef54bc179b1684bebc6995a 100644 (file)
@@ -1364,8 +1364,8 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
                if(count($ret[$v]['list']) > MAX_LIKERS) {
                        $ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS);
                        array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-' 
-                               . $ob->get_id() . '"><b>' . t('View all') . '</b></a>');
-               } 
+                               . (($ob) ? $ob->get_id() : $item['id']) . '"><b>' . t('View all') . '</b></a>');
+               }
                else {
                        $ret[$v]['list_part'] = '';
                }
index a19cfaaa7288cb5240dddad5778ba0f55eaddd47..2454f5d51834195f0a24aa750870459bbec020b6 100644 (file)
@@ -1601,18 +1601,23 @@ function photos_content(&$a) {
                        $like = '';
                        $dislike = '';
 
+                       $conv_responses = array(
+                               'like' => array('title' => t('Likes','title')),'dislike' => array('title' => t('Dislikes','title')),
+                               'agree' => array('title' => t('Agree','title')),'disagree' => array('title' => t('Disagree','title')), 'abstain' => array('title' => t('Abstain','title')), 
+                               'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title'))
+                       );
+
 
 
                        // display comments
                        if(count($r)) {
 
                                foreach($r as $item) {
-                                       like_puller($a,$item,$alike,'like');
-                                       like_puller($a,$item,$dlike,'dislike');
+                                       builtin_activity_puller($item, $conv_responses);
                                }
 
-                               $like    = ((isset($alike[$link_item['id']])) ? format_like($alike[$link_item['id']],$alike[$link_item['id'] . '-l'],'like',$link_item['id']) : '');
-                               $dislike = ((isset($dlike[$link_item['id']])) ? format_like($dlike[$link_item['id']],$dlike[$link_item['id'] . '-l'],'dislike',$link_item['id']) : '');
+                               $like    = ((x($conv_responses['like'],$link_item['uri'])) ? format_like($conv_responses['like'][$link_item['uri']],$conv_responses['like'][$link_item['uri'] . '-l'],'like',$link_item['id']) : '');
+                               $dislike = ((x($conv_responses['dislike'],$link_item['uri'])) ? format_like($conv_responses['dislike'][$link_item['uri']],$conv_responses['dislike'][$link_item['uri'] . '-l'],'dislike',$link_item['id']) : '');
 
 
 
@@ -1731,6 +1736,12 @@ function photos_content(&$a) {
                        $paginate = paginate($a);
                }
 
+
+               $response_verbs = array('like');
+               if(feature_enabled($owner_uid,'dislike'))
+                       $response_verbs[] = 'dislike';
+               $responses = get_responses($conv_responses,$response_verbs,'',$link_item);
+
                $photo_tpl = get_markup_template('photo_view.tpl');
 
                if($a->theme['template_engine'] === 'internal') {
@@ -1760,6 +1771,7 @@ function photos_content(&$a) {
                        '$likebuttons' => $likebuttons,
                        '$like' => $like_e,
                        '$dislike' => $dikslike_e,
+                       'responses' => $responses,
                        '$comments' => $comments,
                        '$paginate' => $paginate,
                ));
index d27be50ee2db5bf0729cd935e5aeca3e88d3be2d..8b51f420c61ff77266f1da5acb7bee9b567a542d 100644 (file)
@@ -177,6 +177,7 @@ class Item extends BaseObject {
 
                // 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['object-type'] === ACTIVITY_OBJ_EVENT) {
                        $response_verbs[] = 'attendyes';