Rework of the network page
This commit is contained in:
parent
10803a2598
commit
dd82f150ca
226
mod/network.php
226
mod/network.php
|
@ -36,6 +36,7 @@ use Friendica\Model\Group;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Model\Post\Category;
|
use Friendica\Model\Post\Category;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
|
use Friendica\Module\Contact as ModuleContact;
|
||||||
use Friendica\Module\Security\Login;
|
use Friendica\Module\Security\Login;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
@ -199,17 +200,11 @@ function network_query_get_sel_group(App $a)
|
||||||
*
|
*
|
||||||
* @param App $a The global App
|
* @param App $a The global App
|
||||||
* @param Pager $pager
|
* @param Pager $pager
|
||||||
* @param integer $update Used for the automatic reloading
|
|
||||||
* @return string SQL with the appropriate LIMIT clause
|
* @return string SQL with the appropriate LIMIT clause
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
function networkPager(App $a, Pager $pager, $update)
|
function networkPager(App $a, Pager $pager)
|
||||||
{
|
{
|
||||||
if ($update) {
|
|
||||||
// only setup pagination on initial page view
|
|
||||||
return ' LIMIT 100';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DI::mode()->isMobile()) {
|
if (DI::mode()->isMobile()) {
|
||||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||||
|
@ -225,8 +220,6 @@ function networkPager(App $a, Pager $pager, $update)
|
||||||
}
|
}
|
||||||
|
|
||||||
$pager->setItemsPerPage($itemspage_network);
|
$pager->setItemsPerPage($itemspage_network);
|
||||||
|
|
||||||
return sprintf(" LIMIT %d, %d ", $pager->getStart(), $pager->getItemsPerPage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -359,8 +352,7 @@ function networkFlatView(App $a, $update = 0)
|
||||||
|
|
||||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||||
|
|
||||||
networkPager($a, $pager, $update);
|
networkPager($a, $pager);
|
||||||
|
|
||||||
|
|
||||||
if (strlen($file)) {
|
if (strlen($file)) {
|
||||||
$item_params = ['order' => ['uri-id' => true]];
|
$item_params = ['order' => ['uri-id' => true]];
|
||||||
|
@ -410,19 +402,12 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
global $pager;
|
global $pager;
|
||||||
|
|
||||||
// Rawmode is used for fetching new content at the end of the page
|
// Rawmode is used for fetching new content at the end of the page
|
||||||
$rawmode = (isset($_GET['mode']) AND ( $_GET['mode'] == 'raw'));
|
$rawmode = (isset($_GET['mode']) AND ($_GET['mode'] == 'raw'));
|
||||||
|
|
||||||
if (isset($_GET['last_received']) && isset($_GET['last_commented']) && isset($_GET['last_created']) && isset($_GET['last_id'])) {
|
$last_received = isset($_GET['last_received']) ? DateTimeFormat::utc($_GET['last_received']) : '';
|
||||||
$last_received = DateTimeFormat::utc($_GET['last_received']);
|
$last_commented = isset($_GET['last_commented']) ? DateTimeFormat::utc($_GET['last_commented']) : '';
|
||||||
$last_commented = DateTimeFormat::utc($_GET['last_commented']);
|
$last_created = isset($_GET['last_created']) ? DateTimeFormat::utc($_GET['last_created']) : '';
|
||||||
$last_created = DateTimeFormat::utc($_GET['last_created']);
|
$last_uriid = isset($_GET['last_uriid']) ? intval($_GET['last_uriid']) : 0;
|
||||||
$last_id = intval($_GET['last_id']);
|
|
||||||
} else {
|
|
||||||
$last_received = '';
|
|
||||||
$last_commented = '';
|
|
||||||
$last_created = '';
|
|
||||||
$last_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$datequery = $datequery2 = '';
|
$datequery = $datequery2 = '';
|
||||||
|
|
||||||
|
@ -489,13 +474,9 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
// If $cid belongs to a communitity forum or a privat goup,.add a mention to the status editor
|
// If $cid belongs to a communitity forum or a privat goup,.add a mention to the status editor
|
||||||
$condition = ["`id` = ? AND (`forum` OR `prv`)", $cid];
|
$condition = ["`id` = ? AND (`forum` OR `prv`)", $cid];
|
||||||
$contact = DBA::selectFirst('contact', ['addr', 'nick'], $condition);
|
$contact = DBA::selectFirst('contact', ['addr'], $condition);
|
||||||
if (DBA::isResult($contact)) {
|
if (!empty($contact['addr'])) {
|
||||||
if ($contact['addr'] != '') {
|
|
||||||
$content = '!' . $contact['addr'];
|
$content = '!' . $contact['addr'];
|
||||||
} else {
|
|
||||||
$content = '!' . $contact['nick'] . '+' . $cid;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,25 +499,20 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
$o .= status_editor($a, $x);
|
$o .= status_editor($a, $x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't have to deal with ACLs on this page. You're looking at everything
|
$sql_table = $update ? '`item`' : '`thread`';
|
||||||
// that belongs to you, hence you can see all of it. We will filter by group if
|
|
||||||
// desired.
|
|
||||||
|
|
||||||
$sql_post_table = '';
|
$sql_extra = ($star ? " AND `thread`.`starred` " : '') .
|
||||||
$sql_options = ($star ? " AND `thread`.`starred` " : '');
|
($conv ? " AND $sql_table.`mention`" : '') .
|
||||||
$sql_extra = $sql_options;
|
($nets ? sprintf(" AND $sql_table.`network` = '%s' ", DBA::escape($nets)) : '');
|
||||||
$sql_extra2 = '';
|
|
||||||
$sql_extra3 = '';
|
|
||||||
$sql_table = '`thread`';
|
|
||||||
$sql_parent = '`iid`';
|
|
||||||
|
|
||||||
if ($update) {
|
if ($datequery) {
|
||||||
$sql_table = '`item`';
|
$sql_extra .= Strings::protectSprintf(sprintf(" AND $sql_table.received <= '%s' ",
|
||||||
$sql_parent = '`parent`';
|
DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get()))));
|
||||||
$sql_post_table = " INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent`";
|
}
|
||||||
|
if ($datequery2) {
|
||||||
|
$sql_extra .= Strings::protectSprintf(sprintf(" AND $sql_table.received >= '%s' ",
|
||||||
|
DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_nets = (($nets) ? sprintf(" AND $sql_table.`network` = '%s' ", DBA::escape($nets)) : '');
|
|
||||||
|
|
||||||
if ($gid) {
|
if ($gid) {
|
||||||
$group = DBA::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]);
|
$group = DBA::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]);
|
||||||
|
@ -549,48 +525,18 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
$contacts = Group::expand(local_user(), [$gid]);
|
$sql_extra .= sprintf(" AND `thread`.`contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = %d) ", intval($gid));
|
||||||
|
|
||||||
if ((is_array($contacts)) && count($contacts)) {
|
|
||||||
$contact_str_self = '';
|
|
||||||
|
|
||||||
$contact_str = implode(',', $contacts);
|
|
||||||
$self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
|
|
||||||
if (DBA::isResult($self)) {
|
|
||||||
$contact_str_self = $self['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql_post_table .= " INNER JOIN `item` AS `temp1` ON `temp1`.`id` = " . $sql_table . "." . $sql_parent;
|
|
||||||
$sql_extra3 .= " AND (`thread`.`contact-id` IN ($contact_str) ";
|
|
||||||
$sql_extra3 .= " OR (`thread`.`contact-id` = '$contact_str_self' AND `temp1`.`allow_gid` LIKE '" . Strings::protectSprintf('%<' . intval($gid) . '>%') . "' AND `temp1`.`private`))";
|
|
||||||
} else {
|
|
||||||
$sql_extra3 .= " AND false ";
|
|
||||||
notice(DI::l10n()->t('Group is empty'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
|
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
|
||||||
'$title' => DI::l10n()->t('Group: %s', $group['name'])
|
'$title' => DI::l10n()->t('Group: %s', $group['name'])
|
||||||
]) . $o;
|
]) . $o;
|
||||||
} elseif ($cid) {
|
} elseif ($cid) {
|
||||||
$fields = ['id', 'name', 'network', 'writable', 'nurl', 'avatar',
|
$contact = Contact::getById($cid);
|
||||||
'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
|
|
||||||
$condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid];
|
|
||||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$sql_extra = " AND " . $sql_table . ".`contact-id` = " . intval($cid);
|
$sql_extra .= " AND " . $sql_table . ".`contact-id` = " . intval($cid);
|
||||||
|
|
||||||
$entries[0] = [
|
|
||||||
'id' => 'network',
|
|
||||||
'name' => $contact['name'],
|
|
||||||
'itemurl' => ($contact['addr'] ?? '') ?: $contact['nurl'],
|
|
||||||
'thumb' => Contact::getThumb($contact),
|
|
||||||
'details' => $contact['location'],
|
|
||||||
];
|
|
||||||
|
|
||||||
$entries[0]['account_type'] = Contact::getAccountType($contact);
|
|
||||||
|
|
||||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('viewcontact_template.tpl'), [
|
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('viewcontact_template.tpl'), [
|
||||||
'contacts' => $entries,
|
'contacts' => [ModuleContact::getContactTemplateVars($contact)],
|
||||||
'id' => 'network',
|
'id' => 'network',
|
||||||
]) . $o;
|
]) . $o;
|
||||||
} else {
|
} else {
|
||||||
|
@ -598,26 +544,11 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
DI::baseUrl()->redirect('network');
|
DI::baseUrl()->redirect('network');
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
}
|
} elseif (!$update && !DI::config()->get('theme', 'hide_eventlist')) {
|
||||||
|
|
||||||
if (!$gid && !$cid && !$update && !DI::config()->get('theme', 'hide_eventlist')) {
|
|
||||||
$o .= Profile::getBirthdays();
|
$o .= Profile::getBirthdays();
|
||||||
$o .= Profile::getEventsReminderHTML();
|
$o .= Profile::getEventsReminderHTML();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($datequery) {
|
|
||||||
$sql_extra3 .= Strings::protectSprintf(sprintf(" AND $sql_table.received <= '%s' ",
|
|
||||||
DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get()))));
|
|
||||||
}
|
|
||||||
if ($datequery2) {
|
|
||||||
$sql_extra3 .= Strings::protectSprintf(sprintf(" AND $sql_table.received >= '%s' ",
|
|
||||||
DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($conv) {
|
|
||||||
$sql_extra3 .= " AND $sql_table.`mention`";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normal conversation view
|
// Normal conversation view
|
||||||
if ($order === 'post') {
|
if ($order === 'post') {
|
||||||
$ordering = '`received`';
|
$ordering = '`received`';
|
||||||
|
@ -629,48 +560,34 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
|
|
||||||
$sql_order = "$sql_table.$ordering";
|
$sql_order = "$sql_table.$ordering";
|
||||||
|
|
||||||
if (!empty($_GET['offset'])) {
|
|
||||||
$sql_range = sprintf(" AND $sql_order <= '%s'", DBA::escape($_GET['offset']));
|
|
||||||
} else {
|
|
||||||
$sql_range = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||||
|
|
||||||
$pager_sql = networkPager($a, $pager, $update);
|
networkPager($a, $pager);
|
||||||
|
|
||||||
$last_date = '';
|
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
|
||||||
|
$pager->setPage(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Currently only the order modes "received" and "commented" are in use
|
||||||
switch ($order_mode) {
|
switch ($order_mode) {
|
||||||
case 'received':
|
case 'received':
|
||||||
if ($last_received != '') {
|
if ($last_received != '') {
|
||||||
$last_date = $last_received;
|
$sql_extra .= sprintf(" AND $sql_table.`received` < '%s'", DBA::escape($last_received));
|
||||||
$sql_range .= sprintf(" AND $sql_table.`received` < '%s'", DBA::escape($last_received));
|
|
||||||
$pager->setPage(1);
|
|
||||||
$pager_sql = sprintf(" LIMIT %d, %d ", $pager->getStart(), $pager->getItemsPerPage());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'commented':
|
case 'commented':
|
||||||
if ($last_commented != '') {
|
if ($last_commented != '') {
|
||||||
$last_date = $last_commented;
|
$sql_extra .= sprintf(" AND $sql_table.`commented` < '%s'", DBA::escape($last_commented));
|
||||||
$sql_range .= sprintf(" AND $sql_table.`commented` < '%s'", DBA::escape($last_commented));
|
|
||||||
$pager->setPage(1);
|
|
||||||
$pager_sql = sprintf(" LIMIT %d, %d ", $pager->getStart(), $pager->getItemsPerPage());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'created':
|
case 'created':
|
||||||
if ($last_created != '') {
|
if ($last_created != '') {
|
||||||
$last_date = $last_created;
|
$sql_extra .= sprintf(" AND $sql_table.`created` < '%s'", DBA::escape($last_created));
|
||||||
$sql_range .= sprintf(" AND $sql_table.`created` < '%s'", DBA::escape($last_created));
|
|
||||||
$pager->setPage(1);
|
|
||||||
$pager_sql = sprintf(" LIMIT %d, %d ", $pager->getStart(), $pager->getItemsPerPage());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'id':
|
case 'uriid':
|
||||||
if (($last_id > 0) && ($sql_table == '`thread`')) {
|
if ($last_uriid > 0) {
|
||||||
$sql_range .= sprintf(" AND $sql_table.`iid` < '%s'", DBA::escape($last_id));
|
$sql_extra .= sprintf(" AND $sql_table.`uri-id` < '%s'", DBA::escape($last_uriid));
|
||||||
$pager->setPage(1);
|
|
||||||
$pager_sql = sprintf(" LIMIT %d, %d ", $pager->getStart(), $pager->getItemsPerPage());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -679,73 +596,63 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
if ($update) {
|
if ($update) {
|
||||||
if (!empty($parent)) {
|
if (!empty($parent)) {
|
||||||
// Load only a single thread
|
// Load only a single thread
|
||||||
$sql_extra4 = "`item`.`id` = ".intval($parent);
|
$sql_extra2 = "`item`.`id` = ".intval($parent);
|
||||||
} else {
|
} else {
|
||||||
// Load all unseen items
|
// Load all unseen items
|
||||||
$sql_extra4 = "`item`.`unseen`";
|
$sql_extra2 = "`item`.`unseen`";
|
||||||
if (DI::config()->get("system", "like_no_comment")) {
|
if (DI::config()->get("system", "like_no_comment")) {
|
||||||
$sql_extra4 .= " AND `item`.`gravity` IN (" . GRAVITY_PARENT . "," . GRAVITY_COMMENT . ")";
|
$sql_extra2 .= " AND `item`.`gravity` IN (" . GRAVITY_PARENT . "," . GRAVITY_COMMENT . ")";
|
||||||
}
|
}
|
||||||
if ($order === 'post') {
|
if ($order === 'post') {
|
||||||
// Only show toplevel posts when updating posts in this order mode
|
// Only show toplevel posts when updating posts in this order mode
|
||||||
$sql_extra4 .= " AND `item`.`gravity` = " . GRAVITY_PARENT;
|
$sql_extra2 .= " AND `item`.`gravity` = " . GRAVITY_PARENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT `item`.`parent-uri` AS `uri`, `item`.`parent` AS `item_id`, $sql_order AS `order_date`
|
$r = q("SELECT `item`.`parent-uri` AS `uri`, `item`.`parent` AS `item_id`, $sql_order AS `order_date`
|
||||||
FROM `item` $sql_post_table
|
FROM `item`
|
||||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent`
|
||||||
|
STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
|
||||||
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
|
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
|
||||||
AND (`item`.`gravity` != %d
|
|
||||||
OR `contact`.`uid` = `item`.`uid` AND `contact`.`self`
|
|
||||||
OR `contact`.`rel` IN (%d, %d) AND NOT `contact`.`readonly`)
|
|
||||||
LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = %d
|
LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = %d
|
||||||
WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted`
|
WHERE `thread`.`uid` = %d AND `thread`.`visible` AND NOT `thread`.`deleted`
|
||||||
AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
|
AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
|
||||||
AND NOT `item`.`moderated` AND $sql_extra4
|
AND NOT `thread`.`moderated` AND $sql_extra2
|
||||||
$sql_extra3 $sql_extra $sql_range $sql_nets
|
$sql_extra
|
||||||
ORDER BY `order_date` DESC LIMIT 100",
|
ORDER BY `order_date` DESC LIMIT 100",
|
||||||
intval(GRAVITY_PARENT),
|
|
||||||
intval(Contact::SHARING),
|
|
||||||
intval(Contact::FRIEND),
|
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$r = q("SELECT `item`.`uri`, `thread`.`iid` AS `item_id`, $sql_order AS `order_date`
|
$r = q("SELECT `item`.`uri`, `thread`.`iid` AS `item_id`, $sql_order AS `order_date`
|
||||||
FROM `thread` $sql_post_table
|
FROM `thread`
|
||||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
|
STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
|
||||||
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
|
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
|
||||||
STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
|
STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||||
AND (`item`.`gravity` != %d
|
|
||||||
OR `contact`.`uid` = `item`.`uid` AND `contact`.`self`
|
|
||||||
OR `contact`.`rel` IN (%d, %d) AND NOT `contact`.`readonly`)
|
|
||||||
LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = %d
|
LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = %d
|
||||||
WHERE `thread`.`uid` = %d AND `thread`.`visible` AND NOT `thread`.`deleted`
|
WHERE `thread`.`uid` = %d AND `thread`.`visible` AND NOT `thread`.`deleted`
|
||||||
AND NOT `thread`.`moderated`
|
|
||||||
AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
|
AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
|
||||||
$sql_extra2 $sql_extra3 $sql_range $sql_extra $sql_nets
|
AND NOT `thread`.`moderated`
|
||||||
ORDER BY `order_date` DESC $pager_sql",
|
$sql_extra
|
||||||
intval(GRAVITY_PARENT),
|
ORDER BY `order_date` DESC LIMIT %d, %d",
|
||||||
intval(Contact::SHARING),
|
|
||||||
intval(Contact::FRIEND),
|
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
intval(local_user())
|
intval(local_user()),
|
||||||
|
intval($pager->getStart()),
|
||||||
|
intval($pager->getItemsPerPage())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$parents_str = '';
|
return $o . network_display_post($a, $pager, (!$gid && !$cid && !$star), $update, $ordering, $r);
|
||||||
$date_offset = '';
|
}
|
||||||
|
|
||||||
$items = $r;
|
function network_display_post($a, $pager, $mark_all, $update, $ordering, $items)
|
||||||
|
{
|
||||||
|
$parents_str = '';
|
||||||
|
|
||||||
if (DBA::isResult($items)) {
|
if (DBA::isResult($items)) {
|
||||||
$parents_arr = [];
|
$parents_arr = [];
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
if ($date_offset < $item['order_date']) {
|
|
||||||
$date_offset = $item['order_date'];
|
|
||||||
}
|
|
||||||
if (!in_array($item['item_id'], $parents_arr) && ($item['item_id'] > 0)) {
|
if (!in_array($item['item_id'], $parents_arr) && ($item['item_id'] > 0)) {
|
||||||
$parents_arr[] = $item['item_id'];
|
$parents_arr[] = $item['item_id'];
|
||||||
}
|
}
|
||||||
|
@ -753,14 +660,7 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
$parents_str = implode(', ', $parents_arr);
|
$parents_str = implode(', ', $parents_arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_GET['offset'])) {
|
|
||||||
$date_offset = $_GET['offset'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$query_string = DI::args()->getQueryString();
|
$query_string = DI::args()->getQueryString();
|
||||||
if ($date_offset && !preg_match('/[?&].offset=/', $query_string)) {
|
|
||||||
$query_string .= '&offset=' . urlencode($date_offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pager->setQueryString($query_string);
|
$pager->setQueryString($query_string);
|
||||||
|
|
||||||
|
@ -768,7 +668,7 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
// level which items you've seen and which you haven't. If you're looking
|
// level which items you've seen and which you haven't. If you're looking
|
||||||
// at the top level network page just mark everything seen.
|
// at the top level network page just mark everything seen.
|
||||||
|
|
||||||
if (!$gid && !$cid && !$star) {
|
if ($mark_all) {
|
||||||
$condition = ['unseen' => true, 'uid' => local_user()];
|
$condition = ['unseen' => true, 'uid' => local_user()];
|
||||||
networkSetSeen($condition);
|
networkSetSeen($condition);
|
||||||
} elseif ($parents_str) {
|
} elseif ($parents_str) {
|
||||||
|
@ -776,11 +676,7 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
networkSetSeen($condition);
|
networkSetSeen($condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return networkConversation($a, $items, $pager, 'network', $update, $ordering);
|
||||||
$mode = 'network';
|
|
||||||
$o .= networkConversation($a, $items, $pager, $mode, $update, $ordering);
|
|
||||||
|
|
||||||
return $o;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -492,6 +492,7 @@ class Post
|
||||||
'received' => $item['received'],
|
'received' => $item['received'],
|
||||||
'commented' => $item['commented'],
|
'commented' => $item['commented'],
|
||||||
'created_date' => $item['created'],
|
'created_date' => $item['created'],
|
||||||
|
'uriid' => $item['uri-id'],
|
||||||
'return' => (DI::args()->getCommand()) ? bin2hex(DI::args()->getCommand()) : '',
|
'return' => (DI::args()->getCommand()) ? bin2hex(DI::args()->getCommand()) : '',
|
||||||
'direction' => $direction,
|
'direction' => $direction,
|
||||||
'delivery' => [
|
'delivery' => [
|
||||||
|
|
|
@ -884,16 +884,16 @@ function loadScrollContent() {
|
||||||
commented = "0000-00-00 00:00:00";
|
commented = "0000-00-00 00:00:00";
|
||||||
}
|
}
|
||||||
|
|
||||||
match = $("span.id").last();
|
match = $("span.uriid").last();
|
||||||
if (match.length > 0) {
|
if (match.length > 0) {
|
||||||
id = match[0].innerHTML;
|
uriid = match[0].innerHTML;
|
||||||
} else {
|
} else {
|
||||||
id = "0";
|
uriid = "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the raw content from the next page and insert this content
|
// get the raw content from the next page and insert this content
|
||||||
// right before "#conversation-end"
|
// right before "#conversation-end"
|
||||||
$.get(infinite_scroll.reload_uri + '&mode=raw&last_received=' + received + '&last_commented=' + commented + '&last_created=' + created + '&last_id=' + id + '&page=' + infinite_scroll.pageno, function(data) {
|
$.get(infinite_scroll.reload_uri + '&mode=raw&last_received=' + received + '&last_commented=' + commented + '&last_created=' + created + '&last_uriid=' + uriid + '&page=' + infinite_scroll.pageno, function(data) {
|
||||||
$("#scroll-loader").hide();
|
$("#scroll-loader").hide();
|
||||||
if ($(data).length > 0) {
|
if ($(data).length > 0) {
|
||||||
$(data).insertBefore('#conversation-end');
|
$(data).insertBefore('#conversation-end');
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<span class="commented" style="display: none;">{{$item.commented}}</span>
|
<span class="commented" style="display: none;">{{$item.commented}}</span>
|
||||||
<span class="received" style="display: none;">{{$item.received}}</span>
|
<span class="received" style="display: none;">{{$item.received}}</span>
|
||||||
<span class="created" style="display: none;">{{$item.created_date}}</span>
|
<span class="created" style="display: none;">{{$item.created_date}}</span>
|
||||||
<span class="id" style="display: none;">{{$item.id}}</span>
|
<span class="uriid" style="display: none;">{{$item.uriid}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div id="tread-wrapper-{{$item.id}}" class="tread-wrapper {{$item.toplevel}} {{if $item.toplevel}} h-entry {{else}} u-comment h-cite {{/if}}">
|
<div id="tread-wrapper-{{$item.id}}" class="tread-wrapper {{$item.toplevel}} {{if $item.toplevel}} h-entry {{else}} u-comment h-cite {{/if}}">
|
||||||
<a name="{{$item.id}}" ></a>
|
<a name="{{$item.id}}" ></a>
|
||||||
|
|
|
@ -78,7 +78,7 @@ as the value of $top_child_total (this is done at the end of this file)
|
||||||
<span class="commented" style="display: none;">{{$item.commented}}</span>
|
<span class="commented" style="display: none;">{{$item.commented}}</span>
|
||||||
<span class="received" style="display: none;">{{$item.received}}</span>
|
<span class="received" style="display: none;">{{$item.received}}</span>
|
||||||
<span class="created" style="display: none;">{{$item.created_date}}</span>
|
<span class="created" style="display: none;">{{$item.created_date}}</span>
|
||||||
<span class="id" style="display: none;">{{$item.id}}</span>
|
<span class="uriid" style="display: none;">{{$item.uriid}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="media {{$item.shiny}}">
|
<div class="media {{$item.shiny}}">
|
||||||
{{* The avatar picture and the photo-menu *}}
|
{{* The avatar picture and the photo-menu *}}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<span class="commented" style="display: none;">{{$item.commented}}</span>
|
<span class="commented" style="display: none;">{{$item.commented}}</span>
|
||||||
<span class="received" style="display: none;">{{$item.received}}</span>
|
<span class="received" style="display: none;">{{$item.received}}</span>
|
||||||
<span class="created" style="display: none;">{{$item.created_date}}</span>
|
<span class="created" style="display: none;">{{$item.created_date}}</span>
|
||||||
<span class="id" style="display: none;">{{$item.id}}</span>
|
<span class="uriid" style="display: none;">{{$item.uriid}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class="wall-item-decor">
|
<div class="wall-item-decor">
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<span class="commented" style="display: none;">{{$item.commented}}</span>
|
<span class="commented" style="display: none;">{{$item.commented}}</span>
|
||||||
<span class="received" style="display: none;">{{$item.received}}</span>
|
<span class="received" style="display: none;">{{$item.received}}</span>
|
||||||
<span class="created" style="display: none;">{{$item.created_date}}</span>
|
<span class="created" style="display: none;">{{$item.created_date}}</span>
|
||||||
<span class="id" style="display: none;">{{$item.id}}</span>
|
<span class="uriid" style="display: none;">{{$item.uriid}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="wall-item-item">
|
<div class="wall-item-item">
|
||||||
<div class="wall-item-info">
|
<div class="wall-item-info">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user