Merge pull request #7348 from annando/item-received
Use "received" instead of "created" for sorting items
This commit is contained in:
commit
8146ff1505
12 changed files with 51 additions and 59 deletions
|
@ -34,7 +34,7 @@
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1316);
|
define('DB_UPDATE_VERSION', 1317);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -672,15 +672,15 @@ return [
|
||||||
"extid" => ["extid(191)"],
|
"extid" => ["extid(191)"],
|
||||||
"uid_id" => ["uid", "id"],
|
"uid_id" => ["uid", "id"],
|
||||||
"uid_contactid_id" => ["uid", "contact-id", "id"],
|
"uid_contactid_id" => ["uid", "contact-id", "id"],
|
||||||
"uid_created" => ["uid", "created"],
|
"uid_received" => ["uid", "received"],
|
||||||
"uid_commented" => ["uid", "commented"],
|
"uid_commented" => ["uid", "commented"],
|
||||||
"uid_unseen_contactid" => ["uid", "unseen", "contact-id"],
|
"uid_unseen_contactid" => ["uid", "unseen", "contact-id"],
|
||||||
"uid_network_received" => ["uid", "network", "received"],
|
"uid_network_received" => ["uid", "network", "received"],
|
||||||
"uid_network_commented" => ["uid", "network", "commented"],
|
"uid_network_commented" => ["uid", "network", "commented"],
|
||||||
"uid_thrparent" => ["uid", "thr-parent(190)"],
|
"uid_thrparent" => ["uid", "thr-parent(190)"],
|
||||||
"uid_parenturi" => ["uid", "parent-uri(190)"],
|
"uid_parenturi" => ["uid", "parent-uri(190)"],
|
||||||
"uid_contactid_created" => ["uid", "contact-id", "created"],
|
"uid_contactid_received" => ["uid", "contact-id", "received"],
|
||||||
"authorid_created" => ["author-id", "created"],
|
"authorid_received" => ["author-id", "received"],
|
||||||
"ownerid" => ["owner-id"],
|
"ownerid" => ["owner-id"],
|
||||||
"contact-id" => ["contact-id"],
|
"contact-id" => ["contact-id"],
|
||||||
"uid_uri" => ["uid", "uri(190)"],
|
"uid_uri" => ["uid", "uri(190)"],
|
||||||
|
@ -1256,15 +1256,15 @@ return [
|
||||||
"indexes" => [
|
"indexes" => [
|
||||||
"PRIMARY" => ["iid"],
|
"PRIMARY" => ["iid"],
|
||||||
"uid_network_commented" => ["uid", "network", "commented"],
|
"uid_network_commented" => ["uid", "network", "commented"],
|
||||||
"uid_network_created" => ["uid", "network", "created"],
|
"uid_network_received" => ["uid", "network", "received"],
|
||||||
"uid_contactid_commented" => ["uid", "contact-id", "commented"],
|
"uid_contactid_commented" => ["uid", "contact-id", "commented"],
|
||||||
"uid_contactid_created" => ["uid", "contact-id", "created"],
|
"uid_contactid_received" => ["uid", "contact-id", "received"],
|
||||||
"contactid" => ["contact-id"],
|
"contactid" => ["contact-id"],
|
||||||
"ownerid" => ["owner-id"],
|
"ownerid" => ["owner-id"],
|
||||||
"authorid" => ["author-id"],
|
"authorid" => ["author-id"],
|
||||||
"uid_created" => ["uid", "created"],
|
"uid_received" => ["uid", "received"],
|
||||||
"uid_commented" => ["uid", "commented"],
|
"uid_commented" => ["uid", "commented"],
|
||||||
"uid_wall_created" => ["uid", "wall", "created"],
|
"uid_wall_received" => ["uid", "wall", "received"],
|
||||||
"private_wall_origin_commented" => ["private", "wall", "origin", "commented"],
|
"private_wall_origin_commented" => ["private", "wall", "origin", "commented"],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
|
@ -1107,7 +1107,7 @@ function api_statuses_update($type)
|
||||||
if ($throttle_day > 0) {
|
if ($throttle_day > 0) {
|
||||||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60);
|
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60);
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `wall` AND `created` > ?", api_user(), $datefrom];
|
$condition = ["`uid` = ? AND `wall` AND `received` > ?", api_user(), $datefrom];
|
||||||
$posts_day = DBA::count('thread', $condition);
|
$posts_day = DBA::count('thread', $condition);
|
||||||
|
|
||||||
if ($posts_day > $throttle_day) {
|
if ($posts_day > $throttle_day) {
|
||||||
|
@ -1121,7 +1121,7 @@ function api_statuses_update($type)
|
||||||
if ($throttle_week > 0) {
|
if ($throttle_week > 0) {
|
||||||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*7);
|
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*7);
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `wall` AND `created` > ?", api_user(), $datefrom];
|
$condition = ["`uid` = ? AND `wall` AND `received` > ?", api_user(), $datefrom];
|
||||||
$posts_week = DBA::count('thread', $condition);
|
$posts_week = DBA::count('thread', $condition);
|
||||||
|
|
||||||
if ($posts_week > $throttle_week) {
|
if ($posts_week > $throttle_week) {
|
||||||
|
@ -1135,7 +1135,7 @@ function api_statuses_update($type)
|
||||||
if ($throttle_month > 0) {
|
if ($throttle_month > 0) {
|
||||||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*30);
|
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*30);
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `wall` AND `created` > ?", api_user(), $datefrom];
|
$condition = ["`uid` = ? AND `wall` AND `received` > ?", api_user(), $datefrom];
|
||||||
$posts_month = DBA::count('thread', $condition);
|
$posts_month = DBA::count('thread', $condition);
|
||||||
|
|
||||||
if ($posts_month > $throttle_month) {
|
if ($posts_month > $throttle_month) {
|
||||||
|
@ -5057,7 +5057,7 @@ function api_get_announce($item)
|
||||||
$fields = ['author-id', 'author-name', 'author-link', 'author-avatar'];
|
$fields = ['author-id', 'author-name', 'author-link', 'author-avatar'];
|
||||||
$activity = Item::activityToIndex(ACTIVITY2_ANNOUNCE);
|
$activity = Item::activityToIndex(ACTIVITY2_ANNOUNCE);
|
||||||
$condition = ['parent-uri' => $item['uri'], 'gravity' => GRAVITY_ACTIVITY, 'uid' => [0, $item['uid']], 'activity' => $activity];
|
$condition = ['parent-uri' => $item['uri'], 'gravity' => GRAVITY_ACTIVITY, 'uid' => [0, $item['uid']], 'activity' => $activity];
|
||||||
$announce = Item::selectFirstForUser($item['uid'], $fields, $condition, ['order' => ['created' => true]]);
|
$announce = Item::selectFirstForUser($item['uid'], $fields, $condition, ['order' => ['received' => true]]);
|
||||||
if (!DBA::isResult($announce)) {
|
if (!DBA::isResult($announce)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -800,12 +800,12 @@ function conversation_fetch_comments($thread_items) {
|
||||||
$parentlines = [];
|
$parentlines = [];
|
||||||
$lineno = 0;
|
$lineno = 0;
|
||||||
$actor = [];
|
$actor = [];
|
||||||
$created = '';
|
$received = '';
|
||||||
|
|
||||||
while ($row = Item::fetch($thread_items)) {
|
while ($row = Item::fetch($thread_items)) {
|
||||||
if (($row['verb'] == ACTIVITY2_ANNOUNCE) && !empty($row['contact-uid']) && ($row['created'] > $created) && ($row['thr-parent'] == $row['parent-uri'])) {
|
if (($row['verb'] == ACTIVITY2_ANNOUNCE) && !empty($row['contact-uid']) && ($row['received'] > $received) && ($row['thr-parent'] == $row['parent-uri'])) {
|
||||||
$actor = ['link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']];
|
$actor = ['link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']];
|
||||||
$created = $row['created'];
|
$received = $row['received'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((($row['gravity'] == GRAVITY_PARENT) && !$row['origin'] && !in_array($row['network'], [Protocol::DIASPORA])) &&
|
if ((($row['gravity'] == GRAVITY_PARENT) && !$row['origin'] && !in_array($row['network'], [Protocol::DIASPORA])) &&
|
||||||
|
@ -1316,7 +1316,7 @@ function get_item_children(array &$item_list, array $parent, $recursive = true)
|
||||||
function sort_item_children(array $items)
|
function sort_item_children(array $items)
|
||||||
{
|
{
|
||||||
$result = $items;
|
$result = $items;
|
||||||
usort($result, 'sort_thr_created_rev');
|
usort($result, 'sort_thr_received_rev');
|
||||||
foreach ($result as $k => $i) {
|
foreach ($result as $k => $i) {
|
||||||
if (isset($result[$k]['children'])) {
|
if (isset($result[$k]['children'])) {
|
||||||
$result[$k]['children'] = sort_item_children($result[$k]['children']);
|
$result[$k]['children'] = sort_item_children($result[$k]['children']);
|
||||||
|
@ -1401,13 +1401,13 @@ function smart_flatten_conversation(array $parent)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expands a flat list of items into corresponding tree-like conversation structures,
|
* Expands a flat list of items into corresponding tree-like conversation structures,
|
||||||
* sort the top-level posts either on "created" or "commented", and finally
|
* sort the top-level posts either on "received" or "commented", and finally
|
||||||
* append all the items at the top level (???)
|
* append all the items at the top level (???)
|
||||||
*
|
*
|
||||||
* @brief Expands a flat item list into a conversation array for display
|
* @brief Expands a flat item list into a conversation array for display
|
||||||
*
|
*
|
||||||
* @param array $item_list A list of items belonging to one or more conversations
|
* @param array $item_list A list of items belonging to one or more conversations
|
||||||
* @param string $order Either on "created" or "commented"
|
* @param string $order Either on "received" or "commented"
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
|
@ -1439,8 +1439,8 @@ function conv_sort(array $item_list, $order)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stristr($order, 'created')) {
|
if (stristr($order, 'received')) {
|
||||||
usort($parents, 'sort_thr_created');
|
usort($parents, 'sort_thr_received');
|
||||||
} elseif (stristr($order, 'commented')) {
|
} elseif (stristr($order, 'commented')) {
|
||||||
usort($parents, 'sort_thr_commented');
|
usort($parents, 'sort_thr_commented');
|
||||||
}
|
}
|
||||||
|
@ -1477,27 +1477,27 @@ function conv_sort(array $item_list, $order)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief usort() callback to sort item arrays by the created key
|
* @brief usort() callback to sort item arrays by the received key
|
||||||
*
|
*
|
||||||
* @param array $a
|
* @param array $a
|
||||||
* @param array $b
|
* @param array $b
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function sort_thr_created(array $a, array $b)
|
function sort_thr_received(array $a, array $b)
|
||||||
{
|
{
|
||||||
return strcmp($b['created'], $a['created']);
|
return strcmp($b['received'], $a['received']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief usort() callback to reverse sort item arrays by the created key
|
* @brief usort() callback to reverse sort item arrays by the received key
|
||||||
*
|
*
|
||||||
* @param array $a
|
* @param array $a
|
||||||
* @param array $b
|
* @param array $b
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function sort_thr_created_rev(array $a, array $b)
|
function sort_thr_received_rev(array $a, array $b)
|
||||||
{
|
{
|
||||||
return strcmp($a['created'], $b['created']);
|
return strcmp($a['received'], $b['received']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -704,11 +704,11 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($datequery) {
|
if ($datequery) {
|
||||||
$sql_extra3 .= Strings::protectSprintf(sprintf(" AND $sql_table.created <= '%s' ",
|
$sql_extra3 .= Strings::protectSprintf(sprintf(" AND $sql_table.received <= '%s' ",
|
||||||
DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get()))));
|
DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get()))));
|
||||||
}
|
}
|
||||||
if ($datequery2) {
|
if ($datequery2) {
|
||||||
$sql_extra3 .= Strings::protectSprintf(sprintf(" AND $sql_table.created >= '%s' ",
|
$sql_extra3 .= Strings::protectSprintf(sprintf(" AND $sql_table.received >= '%s' ",
|
||||||
DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get()))));
|
DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,8 +718,8 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
|
|
||||||
// Normal conversation view
|
// Normal conversation view
|
||||||
if ($order === 'post') {
|
if ($order === 'post') {
|
||||||
$ordering = '`created`';
|
$ordering = '`received`';
|
||||||
$order_mode = 'created';
|
$order_mode = 'received';
|
||||||
} else {
|
} else {
|
||||||
$ordering = '`commented`';
|
$ordering = '`commented`';
|
||||||
$order_mode = 'commented';
|
$order_mode = 'commented';
|
||||||
|
|
|
@ -123,7 +123,7 @@ function ping_init(App $a)
|
||||||
$condition = ["`unseen` AND `uid` = ? AND `contact-id` != ?", local_user(), local_user()];
|
$condition = ["`unseen` AND `uid` = ? AND `contact-id` != ?", local_user(), local_user()];
|
||||||
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
||||||
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'wall'];
|
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'wall'];
|
||||||
$params = ['order' => ['created' => true]];
|
$params = ['order' => ['received' => true]];
|
||||||
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
||||||
|
|
||||||
if (DBA::isResult($items)) {
|
if (DBA::isResult($items)) {
|
||||||
|
|
|
@ -186,7 +186,7 @@ function search_content(App $a) {
|
||||||
$condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
|
$condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
|
||||||
AND `otype` = ? AND `type` = ? AND `term` = ?",
|
AND `otype` = ? AND `type` = ? AND `term` = ?",
|
||||||
local_user(), TERM_OBJ_POST, TERM_HASHTAG, $search];
|
local_user(), TERM_OBJ_POST, TERM_HASHTAG, $search];
|
||||||
$params = ['order' => ['created' => true],
|
$params = ['order' => ['received' => true],
|
||||||
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||||
$terms = DBA::select('term', ['oid'], $condition, $params);
|
$terms = DBA::select('term', ['oid'], $condition, $params);
|
||||||
|
|
||||||
|
|
|
@ -394,7 +394,7 @@ class NotificationsManager extends BaseObject
|
||||||
|
|
||||||
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
||||||
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
|
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
|
||||||
$params = ['order' => ['created' => true], 'limit' => [$start, $limit]];
|
$params = ['order' => ['received' => true], 'limit' => [$start, $limit]];
|
||||||
|
|
||||||
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ class NotificationsManager extends BaseObject
|
||||||
|
|
||||||
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
||||||
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
|
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
|
||||||
$params = ['order' => ['created' => true], 'limit' => [$start, $limit]];
|
$params = ['order' => ['received' => true], 'limit' => [$start, $limit]];
|
||||||
|
|
||||||
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ class NotificationsManager extends BaseObject
|
||||||
|
|
||||||
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
||||||
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
|
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
|
||||||
$params = ['order' => ['created' => true], 'limit' => [$start, $limit]];
|
$params = ['order' => ['received' => true], 'limit' => [$start, $limit]];
|
||||||
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
||||||
|
|
||||||
if (DBA::isResult($items)) {
|
if (DBA::isResult($items)) {
|
||||||
|
|
|
@ -1616,7 +1616,7 @@ class Contact extends BaseObject
|
||||||
|
|
||||||
$pager = new Pager($a->query_string);
|
$pager = new Pager($a->query_string);
|
||||||
|
|
||||||
$params = ['order' => ['created' => true],
|
$params = ['order' => ['received' => true],
|
||||||
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||||
|
|
||||||
if ($thread_mode) {
|
if ($thread_mode) {
|
||||||
|
|
|
@ -1650,7 +1650,7 @@ class Item extends BaseObject
|
||||||
Logger::log('duplicated item with the same guid found. '.print_r($item,true));
|
Logger::log('duplicated item with the same guid found. '.print_r($item,true));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} elseif ($item['network'] == Protocol::OSTATUS) {
|
||||||
// Check for an existing post with the same content. There seems to be a problem with OStatus.
|
// Check for an existing post with the same content. There seems to be a problem with OStatus.
|
||||||
$condition = ["`body` = ? AND `network` = ? AND `created` = ? AND `contact-id` = ? AND `uid` = ?",
|
$condition = ["`body` = ? AND `network` = ? AND `created` = ? AND `contact-id` = ? AND `uid` = ?",
|
||||||
$item['body'], $item['network'], $item['created'], $item['contact-id'], $item['uid']];
|
$item['body'], $item['network'], $item['created'], $item['contact-id'], $item['uid']];
|
||||||
|
@ -2905,19 +2905,11 @@ class Item extends BaseObject
|
||||||
if ($network != "") {
|
if ($network != "") {
|
||||||
$condition[0] .= " AND `network` = ?";
|
$condition[0] .= " AND `network` = ?";
|
||||||
$condition[] = $network;
|
$condition[] = $network;
|
||||||
|
|
||||||
/*
|
|
||||||
* There is an index "uid_network_received" but not "uid_network_created"
|
|
||||||
* This avoids the creation of another index just for one purpose.
|
|
||||||
* And it doesn't really matter wether to look at "received" or "created"
|
|
||||||
*/
|
|
||||||
$condition[0] .= " AND `received` < UTC_TIMESTAMP() - INTERVAL ? DAY";
|
|
||||||
$condition[] = $days;
|
|
||||||
} else {
|
|
||||||
$condition[0] .= " AND `created` < UTC_TIMESTAMP() - INTERVAL ? DAY";
|
|
||||||
$condition[] = $days;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$condition[0] .= " AND `received` < UTC_TIMESTAMP() - INTERVAL ? DAY";
|
||||||
|
$condition[] = $days;
|
||||||
|
|
||||||
$items = self::select(['file', 'resource-id', 'starred', 'type', 'id', 'post-type'], $condition);
|
$items = self::select(['file', 'resource-id', 'starred', 'type', 'id', 'post-type'], $condition);
|
||||||
|
|
||||||
if (!DBA::isResult($items)) {
|
if (!DBA::isResult($items)) {
|
||||||
|
@ -2967,10 +2959,10 @@ class Item extends BaseObject
|
||||||
public static function firstPostDate($uid, $wall = false)
|
public static function firstPostDate($uid, $wall = false)
|
||||||
{
|
{
|
||||||
$condition = ['uid' => $uid, 'wall' => $wall, 'deleted' => false, 'visible' => true, 'moderated' => false];
|
$condition = ['uid' => $uid, 'wall' => $wall, 'deleted' => false, 'visible' => true, 'moderated' => false];
|
||||||
$params = ['order' => ['created' => false]];
|
$params = ['order' => ['received' => false]];
|
||||||
$thread = DBA::selectFirst('thread', ['created'], $condition, $params);
|
$thread = DBA::selectFirst('thread', ['received'], $condition, $params);
|
||||||
if (DBA::isResult($thread)) {
|
if (DBA::isResult($thread)) {
|
||||||
return substr(DateTimeFormat::local($thread['created']), 0, 10);
|
return substr(DateTimeFormat::local($thread['received']), 0, 10);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,7 +252,7 @@ class Profile extends BaseModule
|
||||||
AND `item`.`wall`
|
AND `item`.`wall`
|
||||||
$sql_extra4
|
$sql_extra4
|
||||||
$sql_extra
|
$sql_extra
|
||||||
ORDER BY `item`.`created` DESC",
|
ORDER BY `item`.`received` DESC",
|
||||||
$a->profile['profile_uid'],
|
$a->profile['profile_uid'],
|
||||||
GRAVITY_ACTIVITY
|
GRAVITY_ACTIVITY
|
||||||
);
|
);
|
||||||
|
@ -276,10 +276,10 @@ class Profile extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($datequery)) {
|
if (!empty($datequery)) {
|
||||||
$sql_extra2 .= Strings::protectSprintf(sprintf(" AND `thread`.`created` <= '%s' ", DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get()))));
|
$sql_extra2 .= Strings::protectSprintf(sprintf(" AND `thread`.`received` <= '%s' ", DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get()))));
|
||||||
}
|
}
|
||||||
if (!empty($datequery2)) {
|
if (!empty($datequery2)) {
|
||||||
$sql_extra2 .= Strings::protectSprintf(sprintf(" AND `thread`.`created` >= '%s' ", DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get()))));
|
$sql_extra2 .= Strings::protectSprintf(sprintf(" AND `thread`.`received` >= '%s' ", DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does the profile page belong to a forum?
|
// Does the profile page belong to a forum?
|
||||||
|
@ -326,7 +326,7 @@ class Profile extends BaseModule
|
||||||
$sql_extra3
|
$sql_extra3
|
||||||
$sql_extra
|
$sql_extra
|
||||||
$sql_extra2
|
$sql_extra2
|
||||||
ORDER BY `thread`.`created` DESC
|
ORDER BY `thread`.`received` DESC
|
||||||
$pager_sql",
|
$pager_sql",
|
||||||
$a->profile['profile_uid']
|
$a->profile['profile_uid']
|
||||||
);
|
);
|
||||||
|
@ -351,7 +351,7 @@ class Profile extends BaseModule
|
||||||
|
|
||||||
$items = DBA::toArray($items_stmt);
|
$items = DBA::toArray($items_stmt);
|
||||||
|
|
||||||
$o .= conversation($a, $items, $pager, 'profile', $update, false, 'created', $a->profile['profile_uid']);
|
$o .= conversation($a, $items, $pager, 'profile', $update, false, 'received', $a->profile['profile_uid']);
|
||||||
|
|
||||||
if (!$update) {
|
if (!$update) {
|
||||||
$o .= $pager->renderMinimal(count($items));
|
$o .= $pager->renderMinimal(count($items));
|
||||||
|
|
|
@ -257,7 +257,7 @@ class DFRN
|
||||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||||
WHERE `item`.`uid` = %d AND `item`.`wall` AND `item`.`changed` > '%s'
|
WHERE `item`.`uid` = %d AND `item`.`wall` AND `item`.`changed` > '%s'
|
||||||
AND `item`.`visible` $sql_extra
|
AND `item`.`visible` $sql_extra
|
||||||
ORDER BY `item`.`parent` ".$sort.", `item`.`created` ASC LIMIT 0, 300",
|
ORDER BY `item`.`parent` ".$sort.", `item`.`received` ASC LIMIT 0, 300",
|
||||||
intval($owner_id),
|
intval($owner_id),
|
||||||
DBA::escape($check_date),
|
DBA::escape($check_date),
|
||||||
DBA::escape($sort)
|
DBA::escape($sort)
|
||||||
|
|
|
@ -2219,7 +2219,7 @@ class OStatus
|
||||||
$check_date = DateTimeFormat::utc($last_update);
|
$check_date = DateTimeFormat::utc($last_update);
|
||||||
$authorid = Contact::getIdForURL($owner["url"], 0, true);
|
$authorid = Contact::getIdForURL($owner["url"], 0, true);
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `created` > ? AND NOT `deleted`
|
$condition = ["`uid` = ? AND `received` > ? AND NOT `deleted`
|
||||||
AND NOT `private` AND `visible` AND `wall` AND `parent-network` IN (?, ?)",
|
AND NOT `private` AND `visible` AND `wall` AND `parent-network` IN (?, ?)",
|
||||||
$owner["uid"], $check_date, Protocol::OSTATUS, Protocol::DFRN];
|
$owner["uid"], $check_date, Protocol::OSTATUS, Protocol::DFRN];
|
||||||
|
|
||||||
|
@ -2234,7 +2234,7 @@ class OStatus
|
||||||
$condition[] = $authorid;
|
$condition[] = $authorid;
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = ['order' => ['created' => true], 'limit' => $max_items];
|
$params = ['order' => ['received' => true], 'limit' => $max_items];
|
||||||
|
|
||||||
if ($filter === 'posts') {
|
if ($filter === 'posts') {
|
||||||
$ret = Item::selectThread([], $condition, $params);
|
$ret = Item::selectThread([], $condition, $params);
|
||||||
|
|
Loading…
Reference in a new issue