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) {
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;
}}

View file

@ -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();

View 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;
}
}
?>