aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mod/network.php17
-rw-r--r--version.inc2
2 files changed, 18 insertions, 1 deletions
diff --git a/mod/network.php b/mod/network.php
index f12471467..1116f2f81 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -315,6 +315,21 @@ function network_content(&$a, $update = 0, $load = false) {
}
$simple_update = (($update) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " ) " : '');
+
+ // This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day
+ // or three and look at your matrix page - after opening up your browser. The first page loads just as it
+ // should. All of a sudden a few seconds later, page 2 will get inserted at the beginning of the page
+ // (before the page 1 content). The update code is actually doing just what it's supposed
+ // to, it's fetching posts that have the ITEM_UNSEEN bit set. But the reason that page 2 content is being
+ // returned in an UPDATE is because you hadn't gotten that far yet - you're still on page 1 and everything
+ // that we loaded for page 1 is now marked as seen. But the stuff on page 2 hasn't been. So... it's being
+ // treated as "new fresh" content because it is unseen. We need to distinguish it somehow from content
+ // which "arrived as you were reading page 1". We're going to do this
+ // by storing in your session the current UTC time whenever you LOAD a network page, and only UPDATE items
+ // 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']);
if($load)
$simple_update = '';
@@ -345,6 +360,8 @@ function network_content(&$a, $update = 0, $load = false) {
if($load) {
+ $_SESSION['loadtime'] = datetime_convert();
+
// Fetch a page full of parent items for this page
$r = q("SELECT distinct item.id AS item_id FROM item
diff --git a/version.inc b/version.inc
index 97bf2e20b..16bb3d2f5 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2014-07-20.742
+2014-07-21.743