These Fields are not added below (yet). They are here to for bug search.
`item`.`type`,
`item`.`extid`,
-`item`.`received`,
`item`.`changed`,
`item`.`moderated`,
`item`.`target-type`,
`item`.`owner-id`, `item`.`owner-link`, `item`.`owner-name`, `item`.`owner-avatar`,
`item`.`contact-id`, `item`.`uid`, `item`.`id`, `item`.`parent`,
`item`.`uri`, `item`.`thr-parent`, `item`.`parent-uri`,
- `item`.`commented`, `item`.`created`, `item`.`edited`,
+ `item`.`commented`, `item`.`created`, `item`.`edited`, `item`.`received`,
`item`.`verb`, `item`.`object-type`, `item`.`postopts`, `item`.`plink`,
`item`.`guid`, `item`.`wall`, `item`.`private`, `item`.`starred`,
`item`.`title`, `item`.`body`, `item`.`file`, `item`.`event-id`,
// page number
infinite_scroll.pageno+=1;
+ match = $("span.received").last();
+ if (match.length > 0) {
+ received = match[0].innerHTML;
+ } else {
+ received = "0000-00-00 00:00:00";
+ }
+
+ match = $("span.created").last();
+ if (match.length > 0) {
+ created = match[0].innerHTML;
+ } else {
+ created = "0000-00-00 00:00:00";
+ }
+
+ match = $("span.commented").last();
+ if (match.length > 0) {
+ commented = match[0].innerHTML;
+ } else {
+ commented = "0000-00-00 00:00:00";
+ }
+
+ match = $("span.id").last();
+ if (match.length > 0) {
+ id = match[0].innerHTML;
+ } else {
+ id = "0";
+ }
+ // console.log("Received: " + received + " - Commented: " + commented+ " - Created: " + created + " - ID: " + id);
+
// get the raw content from the next page and insert this content
// right before "#conversation-end"
- $.get('network?mode=raw' + infinite_scroll.reload_uri + '&page=' + infinite_scroll.pageno, function(data) {
+ $.get('network?mode=raw' + infinite_scroll.reload_uri + '&last_received=' + received + '&last_commented=' + commented + '&last_created=' + created + '&last_id=' + id + '&page=' + infinite_scroll.pageno, function(data) {
$("#scroll-loader").hide();
if ($(data).length > 0) {
+
$(data).insertBefore('#conversation-end');
lockLoadContent = false;
} else {
// Rawmode is used for fetching new content at the end of the page
$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 = dbm::date($_GET["last_received"]);
+ $last_commented = dbm::date($_GET["last_commented"]);
+ $last_created = dbm::date($_GET["last_created"]);
+ $last_id = intval($_GET["last_id"]);
+ } else {
+ $last_received = '';
+ $last_commented = '';
+ $last_created = '';
+ $last_id = 0;
+ }
+
/// @TODO Is this really necessary? $a is already available to hooks
$arr = array('query' => $a->query_string);
call_hooks('network_content_init', $arr);
$order_mode = "id";
}
- if($conv)
+ if ($conv) {
$sql_extra3 .= " AND $sql_table.`mention`";
-
- if($update) {
-
+ }
+ if ($update) {
// only setup pagination on initial page view
$pager_sql = '';
-
} else {
// check if we serve a mobile device and get the user settings
// accordingly
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
}
- if($nouveau) {
+ if ($nouveau) {
$simple_update = (($update) ? " AND `item`.`unseen` " : '');
if ($sql_order == "")
} else {
// Normal conversation view
-
-
if($order === 'post') {
$ordering = "`created`";
if ($sql_order == "")
if (($_GET["offset"] != ""))
$sql_extra3 .= sprintf(" AND $sql_order <= '%s'", dbesc($_GET["offset"]));
+ switch ($order_mode) {
+ case 'received':
+ if ($last_received != '') {
+ $sql_extra3 .= sprintf(" AND $sql_table.`received` < '%s'", dbesc($last_received));
+ $a->set_pager_page(1);
+ $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
+ }
+ break;
+ case 'commented':
+ if ($last_commented != '') {
+ $sql_extra3 .= sprintf(" AND $sql_table.`commented` < '%s'", dbesc($last_commented));
+ $a->set_pager_page(1);
+ $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
+ }
+ break;
+ case 'created':
+ if ($last_created != '') {
+ $sql_extra3 .= sprintf(" AND $sql_table.`created` < '%s'", dbesc($last_created));
+ $a->set_pager_page(1);
+ $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
+ }
+ break;
+ case 'id':
+ if (($last_id > 0) && ($sql_table == "`thread`")) {
+ $sql_extra3 .= sprintf(" AND $sql_table.`iid` < '%s'", dbesc($last_id));
+ $a->set_pager_page(1);
+ $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
+ }
+ break;
+ }
+
// Fetch a page full of parent items for this page
- if($update) {
+ if ($update) {
if (get_config("system", "like_no_comment"))
$sql_extra4 = " AND `item`.`verb` = '".ACTIVITY_POST."'";
else
'edited' => $edited,
'network' => $item["item_network"],
'network_name' => network_to_name($item['item_network'], $profile_link),
+ 'received' => $item['received'],
+ 'commented' => $item['commented'],
+ 'created_date' => $item['created'],
);
$arr = array('item' => $item, 'output' => $tmp_item);
</div>
<div id="collapsed-comments-{{$item.id}}" class="collapsed-comments" style="display: none;">
{{/if}}
+{{if $item.thread_level==1}}
+<span class="commented" style="display: none;">{{$item.commented}}</span>
+<span class="received" style="display: none;">{{$item.received}}</span>
+<span class="created" style="display: none;">{{$item.created_date}}</span>
+<span class="id" style="display: none;">{{$item.id}}</span>
+{{/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>
<div class="wall-item-outside-wrapper {{$item.indent}}{{$item.previewing}}{{if $item.owner_url}} wallwall{{/if}}" id="wall-item-outside-wrapper-{{$item.id}}" >
<div class="item-{{$item.id}} wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_{{$item.thread_level}} {{if $item.thread_level==1}}panel-body h-entry{{else}}u-comment h-cite{{/if}}" id="item-{{$item.guid}}"><!-- wall-item-container -->
{{else}}
<div class="item-{{$item.id}} wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_7 u-comment h-cite" id="item-{{$item.guid}}">
- {{/if}}
+{{/if}}
+{{if $item.thread_level==1}}
+<span class="commented" style="display: none;">{{$item.commented}}</span>
+<span class="received" style="display: none;">{{$item.received}}</span>
+<span class="created" style="display: none;">{{$item.created_date}}</span>
+<span class="id" style="display: none;">{{$item.id}}</span>
+{{/if}}
<div class="media">
{{* Put addional actions in a top-right dropdown menu *}}
{{/if}}
{{/if}}
-{{if $item.thread_level!=1}}<div class="children u-comment h-cite">{{/if}}
+{{if $item.thread_level!=1}}
+<div class="children u-comment h-cite">
+{{else}}
+<span class="commented" style="display: none;">{{$item.commented}}</span>
+<span class="received" style="display: none;">{{$item.received}}</span>
+<span class="created" style="display: none;">{{$item.created_date}}</span>
+<span class="id" style="display: none;">{{$item.id}}</span>
+{{/if}}
<div class="wall-item-decor">
{{if $item.star}}<span class="icon s22 star {{$item.isstarred}}" id="starred-{{$item.id}}" title="{{$item.star.starred}}">{{$item.star.starred}}</span>{{/if}}
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_{{$item.thread_level}}" id="item-{{$item.guid}}">
{{else}}
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_7" id="item-{{$item.guid}}">
+{{/if}}
+{{if $item.thread_level==1}}
+<span class="commented" style="display: none;">{{$item.commented}}</span>
+<span class="received" style="display: none;">{{$item.received}}</span>
+<span class="created" style="display: none;">{{$item.created_date}}</span>
+<span class="id" style="display: none;">{{$item.id}}</span>
{{/if}}
<div class="wall-item-item">
<div class="wall-item-info">