Merge pull request #4241 from annando/network-update

Update after comment on public post should now work on the network page
This commit is contained in:
Hypolite Petovan 2018-01-15 09:16:00 -05:00 committed by GitHub
commit 224cfb2746
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -810,10 +810,16 @@ function networkThreadedView(App $a, $update = 0) {
} }
// Only show it when unfiltered (no groups, no networks, ...) // Only show it when unfiltered (no groups, no networks, ...)
if (Config::get('system', 'comment_public') && (count($r) > 0) && in_array($nets, ['', NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]) if (Config::get('system', 'comment_public') && in_array($nets, ['', NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])
&& (strlen($sql_extra . $sql_extra2 . $sql_extra3 . $sql_extra4) == 0)) { && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
$top_limit = current($r)['order_date'];
$bottom_limit = end($r)['order_date']; if (DBM::is_result($r)) {
$top_limit = current($r)['order_date'];
$bottom_limit = end($r)['order_date'];
} else {
$top_limit = datetime_convert();
$bottom_limit = datetime_convert();
}
// When checking for updates we need to fetch from the newest date to the newest date before // When checking for updates we need to fetch from the newest date to the newest date before
if ($update && !empty($_SESSION['network_last_date']) && ($bottom_limit > $_SESSION['network_last_date'])) { if ($update && !empty($_SESSION['network_last_date']) && ($bottom_limit > $_SESSION['network_last_date'])) {
@ -823,6 +829,9 @@ function networkThreadedView(App $a, $update = 0) {
if ($last_date > $top_limit) { if ($last_date > $top_limit) {
$top_limit = $last_date; $top_limit = $last_date;
} elseif ($a->pager['page'] == 1) {
// Highest possible top limit when we are on the first page
$top_limit = datetime_convert();
} }
$items = dba::p("SELECT `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid` FROM `item` $items = dba::p("SELECT `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid` FROM `item`