From: friendica Date: Fri, 28 Sep 2012 02:53:55 +0000 (-0700) Subject: subscribe-to/follow threads X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cef516956799589c7a7a17c57e7576a87047418f;p=friendica.git subscribe-to/follow threads --- diff --git a/include/conversation.php b/include/conversation.php index 57fe0d66e6..b41f3f0b76 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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 .= "
  • $k
  • \n"; + if(strpos($v,'javascript:') === 0) { + $v = substr($v,11); + $o .= "
  • $k
  • \n"; + } + elseif ($v!="") $o .= "
  • $k
  • \n"; } return $o; }} diff --git a/js/main.js b/js/main.js index a28c8576f0..bd6dfc8520 100644 --- a/js/main.js +++ b/js/main.js @@ -380,11 +380,17 @@ 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(); diff --git a/object/Item.php b/object/Item.php index a0adb1346f..892040dd31 100644 --- a/object/Item.php +++ b/object/Item.php @@ -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; } + + + + } ?>