Merge remote-tracking branch 'friendica.github.com/develop' into task/relationship-status

This commit is contained in:
Jeroen De Meerleer 2019-07-08 07:48:07 +02:00
commit 6811ee5d16
12 changed files with 50 additions and 58 deletions

View file

@ -394,7 +394,7 @@ class NotificationsManager extends BaseObject
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
'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);
@ -485,7 +485,7 @@ class NotificationsManager extends BaseObject
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
'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);
@ -527,7 +527,7 @@ class NotificationsManager extends BaseObject
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
'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);
if (DBA::isResult($items)) {

View file

@ -1616,7 +1616,7 @@ class Contact extends BaseObject
$pager = new Pager($a->query_string);
$params = ['order' => ['created' => true],
$params = ['order' => ['received' => true],
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
if ($thread_mode) {

View file

@ -1650,7 +1650,7 @@ class Item extends BaseObject
Logger::log('duplicated item with the same guid found. '.print_r($item,true));
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.
$condition = ["`body` = ? AND `network` = ? AND `created` = ? AND `contact-id` = ? AND `uid` = ?",
$item['body'], $item['network'], $item['created'], $item['contact-id'], $item['uid']];
@ -2905,19 +2905,11 @@ class Item extends BaseObject
if ($network != "") {
$condition[0] .= " AND `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);
if (!DBA::isResult($items)) {
@ -2967,10 +2959,10 @@ class Item extends BaseObject
public static function firstPostDate($uid, $wall = false)
{
$condition = ['uid' => $uid, 'wall' => $wall, 'deleted' => false, 'visible' => true, 'moderated' => false];
$params = ['order' => ['created' => false]];
$thread = DBA::selectFirst('thread', ['created'], $condition, $params);
$params = ['order' => ['received' => false]];
$thread = DBA::selectFirst('thread', ['received'], $condition, $params);
if (DBA::isResult($thread)) {
return substr(DateTimeFormat::local($thread['created']), 0, 10);
return substr(DateTimeFormat::local($thread['received']), 0, 10);
}
return false;
}

View file

@ -252,7 +252,7 @@ class Profile extends BaseModule
AND `item`.`wall`
$sql_extra4
$sql_extra
ORDER BY `item`.`created` DESC",
ORDER BY `item`.`received` DESC",
$a->profile['profile_uid'],
GRAVITY_ACTIVITY
);
@ -276,10 +276,10 @@ class Profile extends BaseModule
}
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)) {
$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?
@ -326,7 +326,7 @@ class Profile extends BaseModule
$sql_extra3
$sql_extra
$sql_extra2
ORDER BY `thread`.`created` DESC
ORDER BY `thread`.`received` DESC
$pager_sql",
$a->profile['profile_uid']
);
@ -351,7 +351,7 @@ class Profile extends BaseModule
$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) {
$o .= $pager->renderMinimal(count($items));

View file

@ -257,7 +257,7 @@ class DFRN
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`wall` AND `item`.`changed` > '%s'
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),
DBA::escape($check_date),
DBA::escape($sort)

View file

@ -2219,7 +2219,7 @@ class OStatus
$check_date = DateTimeFormat::utc($last_update);
$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 (?, ?)",
$owner["uid"], $check_date, Protocol::OSTATUS, Protocol::DFRN];
@ -2234,7 +2234,7 @@ class OStatus
$condition[] = $authorid;
}
$params = ['order' => ['created' => true], 'limit' => $max_items];
$params = ['order' => ['received' => true], 'limit' => $max_items];
if ($filter === 'posts') {
$ret = Item::selectThread([], $condition, $params);