diff options
-rw-r--r-- | mod/channel.php | 5 | ||||
-rw-r--r-- | mod/home.php | 3 | ||||
-rwxr-xr-x | mod/like.php | 8 | ||||
-rw-r--r-- | mod/network.php | 5 | ||||
-rw-r--r-- | version.inc | 2 |
5 files changed, 15 insertions, 8 deletions
diff --git a/mod/channel.php b/mod/channel.php index 3fc4a9269..16aac2e51 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -158,13 +158,11 @@ function channel_content(&$a, $update = 0, $load = false) { $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - if($update && $_SESSION['loadtime']) - $simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' "; + $simple_update = " AND ( item_unseen = 1 or item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; if($load) $simple_update = ''; - if(($update) && (! $load)) { if ($mid) { $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d AND item_restrict = 0 @@ -185,6 +183,7 @@ function channel_content(&$a, $update = 0, $load = false) { intval(ITEM_WALL), intval(ABOOK_FLAG_BLOCKED) ); + $_SESSION['loadtime'] = datetime_convert(); } } diff --git a/mod/home.php b/mod/home.php index c449a0561..9b2cc0e6d 100644 --- a/mod/home.php +++ b/mod/home.php @@ -185,7 +185,7 @@ function home_content(&$a, $update = 0, $load = false) { $simple_update = (($update) ? " and item.item_unseen = 1 " : ''); if($update && $_SESSION['loadtime']) - $simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' "; + $simple_update = " AND ( item_unseen = 1 or item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; if($load) $simple_update = ''; @@ -221,6 +221,7 @@ function home_content(&$a, $update = 0, $load = false) { $sql_extra3 $sql_extra $sql_nets", intval(ABOOK_FLAG_BLOCKED) ); + $_SESSION['loadtime'] = datetime_convert(); } // Then fetch all the children of the parents that are on this page $parents_str = ''; diff --git a/mod/like.php b/mod/like.php index dc4531fbb..cfd848636 100755 --- a/mod/like.php +++ b/mod/like.php @@ -303,7 +303,7 @@ function like_content(&$a) { $multi_undo = 1; } - $r = q("SELECT id FROM item WHERE verb in ( $verbs ) AND item_restrict = 0 + $r = q("SELECT id, parent, uid FROM item WHERE verb in ( $verbs ) AND item_restrict = 0 AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') and uid = %d ", dbesc($observer['xchan_hash']), intval($item_id), @@ -316,6 +316,12 @@ function like_content(&$a) { require_once('include/items.php'); foreach($r as $rr) { drop_item($rr['id'],false,DROPITEM_PHASE1); + // set the changed timestamp on the parent so we'll see the update without a page reload + $z = q("update item set changed = '%s' where id = %d and uid = %d", + dbesc(datetime_convert()), + intval($rr['parent']), + intval($rr['uid']) + ); } if($interactive) diff --git a/mod/network.php b/mod/network.php index f71a7569a..0cf535769 100644 --- a/mod/network.php +++ b/mod/network.php @@ -396,7 +396,7 @@ function network_content(&$a, $update = 0, $load = false) { // which are both ITEM_UNSEEN and have "changed" since that time. Cross fingers... if($update && $_SESSION['loadtime']) - $simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' "; + $simple_update = " AND ( item_unseen = 1 or item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; if($load) $simple_update = ''; @@ -445,7 +445,7 @@ function network_content(&$a, $update = 0, $load = false) { } else { if(! $firehose) { - // update + // this is an update $r = q("SELECT item.parent AS item_id FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) WHERE true $uids AND item.item_restrict = 0 $simple_update @@ -453,6 +453,7 @@ function network_content(&$a, $update = 0, $load = false) { $sql_extra3 $sql_extra $sql_nets ", intval(ABOOK_FLAG_BLOCKED) ); + $_SESSION['loadtime'] = datetime_convert(); } } diff --git a/version.inc b/version.inc index 35d00274e..b6ad25842 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-03-21.978 +2015-03-22.979 |