]> git.mxchange.org Git - friendica.git/commitdiff
subscribe-to/follow threads
authorfriendica <info@friendica.com>
Fri, 28 Sep 2012 02:53:55 +0000 (19:53 -0700)
committerfriendica <info@friendica.com>
Fri, 28 Sep 2012 02:53:55 +0000 (19:53 -0700)
include/conversation.php
js/main.js
object/Item.php

index 57fe0d66e692fe42ad5c0b423da094c115dc60db..b41f3f0b76ef98c32eed38b6e36b05cf7f262f25 100644 (file)
@@ -341,11 +341,14 @@ function count_descendants($item) {
 
 function visible_activity($item) {
 
-       if(activity_match($child['verb'],ACTIVITY_LIKE) || activity_match($child['verb'],ACTIVITY_DISLIKE))
+       if(activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE))
                return false;
 
-       if(activity_match($item['verb'],ACTIVITY_FOLLOW) && $item['object-type'] === ACTIVITY_OBJ_NOTE && $item['uid'] != local_user())
-               return false;
+       if(activity_match($item['verb'],ACTIVITY_FOLLOW) && $item['object-type'] === ACTIVITY_OBJ_NOTE) {
+               if(! (($item['self']) && ($item['uid'] == local_user()))) {
+                       return false;
+               }
+       }
 
        return true;
 }
@@ -678,6 +681,7 @@ function item_photo_menu($item){
                 if(! count($a->contacts))
                        load_contact_links(local_user());
        }
+       $sub_link="";
        $poke_link="";
        $contact_url="";
        $pm_url="";
@@ -685,6 +689,10 @@ function item_photo_menu($item){
        $photos_link="";
        $posts_link="";
 
+       if((local_user()) && local_user() == $item['uid'] && $item['parent'] == $item['id'] && (! $item['self'])) {
+               $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
+       }
+
        $sparkle = false;
        $profile_link = best_link_url($item,$sparkle,$ssl_state);
        if($profile_link === 'mailbox')
@@ -725,6 +733,7 @@ function item_photo_menu($item){
        }
 
        $menu = Array(
+               t("Follow Thread") => $sub_link,
                t("View Status") => $status_link,
                t("View Profile") => $profile_link,
                t("View Photos") => $photos_link,
@@ -743,7 +752,11 @@ function item_photo_menu($item){
 
        $o = "";
        foreach($menu as $k=>$v){
-               if ($v!="") $o .= "<li><a href=\"$v\">$k</a></li>\n";
+               if(strpos($v,'javascript:') === 0) {
+                       $v = substr($v,11);
+                       $o .= "<li><a href=\"#\" onclick=\"$v\">$k</a></li>\n";
+               }
+               elseif ($v!="") $o .= "<li><a href=\"$v\">$k</a></li>\n";
        }
        return $o;
 }}
index a28c8576f08fe1329ec1db9b6e47afb9b229a2a4..bd6dfc852033948f366e951dcb11f208114ba1a9 100644 (file)
                unpause();
                $('#like-rotator-' + ident.toString()).show();
                $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
-//             if(timer) clearTimeout(timer);
-//             timer = setTimeout(NavUpdate,3000);
                liking = 1;
        }
 
+       function dosubthread(ident) {
+               unpause();
+               $('#like-rotator-' + ident.toString()).show();
+               $.get('subthread/' + ident.toString(), NavUpdate );
+               liking = 1;
+       }
+
+
        function dostar(ident) {
                ident = ident.toString();
                $('#like-rotator-' + ident).show();
index a0adb1346f2e94439e905791185190350046e180..892040dd31eeb3fc7606b2c2789086fcefa6c01e 100644 (file)
@@ -63,7 +63,7 @@ class Item extends BaseObject {
                                if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
                                        continue;
                                }
-                               if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) {
+                               if(! visible_activity($item)) {
                                        continue;
                                }
                                $child = new Item($item);
@@ -332,11 +332,9 @@ class Item extends BaseObject {
                 * Only add what will be displayed
                 */
                if($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid')) {
-                       logger('[WARN] Item::add_child : Item is a mail ('. $item->get_id() .').', LOGGER_DEBUG);
                        return false;
                }
-               if($item->get_data_value('verb') === ACTIVITY_LIKE || $item->get_data_value('verb') === ACTIVITY_DISLIKE) {
-                       logger('[WARN] Item::add_child : Item is a (dis)like ('. $item->get_id() .').', LOGGER_DEBUG);
+               if(activity_match($item->get_data_value('verb'),ACTIVITY_LIKE) || activity_match($item->get_data_value('verb'),ACTIVITY_DISLIKE)) {
                        return false;
                }
                
@@ -660,5 +658,9 @@ class Item extends BaseObject {
        private function is_visiting() {
                return $this->visiting;
        }
+
+
+
+
 }
 ?>