subscribe-to/follow threads

This commit is contained in:
friendica 2012-09-27 19:53:55 -07:00
parent 260b0f7fe8
commit cef5169567
3 changed files with 31 additions and 10 deletions

View File

@ -341,11 +341,14 @@ function count_descendants($item) {
function visible_activity($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; return false;
if(activity_match($item['verb'],ACTIVITY_FOLLOW) && $item['object-type'] === ACTIVITY_OBJ_NOTE && $item['uid'] != local_user()) if(activity_match($item['verb'],ACTIVITY_FOLLOW) && $item['object-type'] === ACTIVITY_OBJ_NOTE) {
return false; if(! (($item['self']) && ($item['uid'] == local_user()))) {
return false;
}
}
return true; return true;
} }
@ -678,6 +681,7 @@ function item_photo_menu($item){
if(! count($a->contacts)) if(! count($a->contacts))
load_contact_links(local_user()); load_contact_links(local_user());
} }
$sub_link="";
$poke_link=""; $poke_link="";
$contact_url=""; $contact_url="";
$pm_url=""; $pm_url="";
@ -685,6 +689,10 @@ function item_photo_menu($item){
$photos_link=""; $photos_link="";
$posts_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; $sparkle = false;
$profile_link = best_link_url($item,$sparkle,$ssl_state); $profile_link = best_link_url($item,$sparkle,$ssl_state);
if($profile_link === 'mailbox') if($profile_link === 'mailbox')
@ -725,6 +733,7 @@ function item_photo_menu($item){
} }
$menu = Array( $menu = Array(
t("Follow Thread") => $sub_link,
t("View Status") => $status_link, t("View Status") => $status_link,
t("View Profile") => $profile_link, t("View Profile") => $profile_link,
t("View Photos") => $photos_link, t("View Photos") => $photos_link,
@ -743,7 +752,11 @@ function item_photo_menu($item){
$o = ""; $o = "";
foreach($menu as $k=>$v){ 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; return $o;
}} }}

View File

@ -380,11 +380,17 @@
unpause(); unpause();
$('#like-rotator-' + ident.toString()).show(); $('#like-rotator-' + ident.toString()).show();
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate ); $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
// if(timer) clearTimeout(timer);
// timer = setTimeout(NavUpdate,3000);
liking = 1; liking = 1;
} }
function dosubthread(ident) {
unpause();
$('#like-rotator-' + ident.toString()).show();
$.get('subthread/' + ident.toString(), NavUpdate );
liking = 1;
}
function dostar(ident) { function dostar(ident) {
ident = ident.toString(); ident = ident.toString();
$('#like-rotator-' + ident).show(); $('#like-rotator-' + ident).show();

View File

@ -63,7 +63,7 @@ class Item extends BaseObject {
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) { if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
continue; continue;
} }
if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) { if(! visible_activity($item)) {
continue; continue;
} }
$child = new Item($item); $child = new Item($item);
@ -332,11 +332,9 @@ class Item extends BaseObject {
* Only add what will be displayed * Only add what will be displayed
*/ */
if($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid')) { 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; return false;
} }
if($item->get_data_value('verb') === ACTIVITY_LIKE || $item->get_data_value('verb') === ACTIVITY_DISLIKE) { if(activity_match($item->get_data_value('verb'),ACTIVITY_LIKE) || activity_match($item->get_data_value('verb'),ACTIVITY_DISLIKE)) {
logger('[WARN] Item::add_child : Item is a (dis)like ('. $item->get_id() .').', LOGGER_DEBUG);
return false; return false;
} }
@ -660,5 +658,9 @@ class Item extends BaseObject {
private function is_visiting() { private function is_visiting() {
return $this->visiting; return $this->visiting;
} }
} }
?> ?>