X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fconversation.php;h=6b7c3afb031ceac2174d3a139a07b7c2fd146944;hb=ab78e2064c57c3d22114aacdc4668b52f431fb9b;hp=57fe0d66e692fe42ad5c0b423da094c115dc60db;hpb=2cacbdb9e708213ee228be4643a0a4601ff8b932;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index 57fe0d66e6..6b7c3afb03 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; } @@ -371,33 +374,79 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $ssl_state = ((local_user()) ? true : false); $profile_owner = 0; - $page_writeable = false; + $page_writeable = false; + $live_update_div = ''; $previewing = (($preview) ? ' preview ' : ''); if($mode === 'network') { $profile_owner = local_user(); $page_writeable = true; + if(!$update) { + // The special div is needed for liveUpdate to kick in for this page. + // We only launch liveUpdate if you aren't filtering in some incompatible + // way and also you aren't writing a comment (discovered in javascript). + + $live_update_div = '
' . "\r\n" + . "\r\n"; + } } - - if($mode === 'profile') { + else if($mode === 'profile') { $profile_owner = $a->profile['profile_uid']; $page_writeable = can_write_wall($a,$profile_owner); - } - if($mode === 'notes') { + if(!$update) { + $tab = notags(trim($_GET['tab'])); + if($tab === 'posts') { + // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, + // because browser prefetching might change it on us. We have to deliver it with the page. + + $live_update_div = '
' . "\r\n" + . "\r\n"; + } + } + } + else if($mode === 'notes') { $profile_owner = local_user(); $page_writeable = true; + if(!$update) { + $live_update_div = '
' . "\r\n" + . "\r\n"; + } } - - if($mode === 'display') { + else if($mode === 'display') { $profile_owner = $a->profile['uid']; $page_writeable = can_write_wall($a,$profile_owner); + $live_update_div = '
' . "\r\n"; } - - if($mode === 'community') { + else if($mode === 'community') { $profile_owner = 0; $page_writeable = false; + if(!$update) { + $live_update_div = '
' . "\r\n" + . "\r\n"; + } + } + else if($mode === 'search') { + $live_update_div = '' . "\r\n"; } $page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false); @@ -627,7 +676,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $o = replace_macros($page_template, array( '$baseurl' => $a->get_baseurl($ssl_state), - '$remove' => t('remove'), + '$live_update' => $live_update_div, + '$remove' => t('remove'), '$mode' => $mode, '$user' => $a->user, '$threads' => $threads, @@ -678,6 +728,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 +736,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 +780,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 +799,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; }}