mirror of
https://github.com/friendica/friendica
synced 2024-12-23 04:40:15 +00:00
Standards and unify variables
This commit is contained in:
parent
52db2b3da1
commit
d1c00cf1f6
4 changed files with 42 additions and 42 deletions
|
@ -159,6 +159,6 @@ class Channel extends Timeline
|
|||
throw new HTTPException\BadRequestException($this->l10n->t('Channel not available.'));
|
||||
}
|
||||
|
||||
$this->max_id = $request['last_created'] ?? $this->max_id;
|
||||
$this->maxId = $request['last_created'] ?? $this->maxId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,6 +196,6 @@ class Community extends Timeline
|
|||
}
|
||||
}
|
||||
|
||||
$this->max_id = $request['last_commented'] ?? $this->max_id;
|
||||
$this->maxId = $request['last_commented'] ?? $this->maxId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -369,17 +369,17 @@ class Network extends Timeline
|
|||
|
||||
switch (self::$order) {
|
||||
case 'received':
|
||||
$this->max_id = $request['last_received'] ?? $this->max_id;
|
||||
$this->maxId = $request['last_received'] ?? $this->maxId;
|
||||
break;
|
||||
case 'created':
|
||||
$this->max_id = $request['last_created'] ?? $this->max_id;
|
||||
$this->maxId = $request['last_created'] ?? $this->maxId;
|
||||
break;
|
||||
case 'uriid':
|
||||
$this->max_id = $request['last_uriid'] ?? $this->max_id;
|
||||
$this->maxId = $request['last_uriid'] ?? $this->maxId;
|
||||
break;
|
||||
default:
|
||||
self::$order = 'commented';
|
||||
$this->max_id = $request['last_commented'] ?? $this->max_id;
|
||||
$this->maxId = $request['last_commented'] ?? $this->maxId;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,42 +421,42 @@ class Network extends Timeline
|
|||
if (!empty($this->itemUriId)) {
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ['uri-id' => $this->itemUriId]);
|
||||
} else {
|
||||
if (isset($this->max_id)) {
|
||||
if (isset($this->maxId)) {
|
||||
switch (self::$order) {
|
||||
case 'received':
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` < ?", $this->max_id]);
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` < ?", $this->maxId]);
|
||||
break;
|
||||
case 'commented':
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` < ?", $this->max_id]);
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` < ?", $this->maxId]);
|
||||
break;
|
||||
case 'created':
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` < ?", $this->max_id]);
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` < ?", $this->maxId]);
|
||||
break;
|
||||
case 'uriid':
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` < ?", $this->max_id]);
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` < ?", $this->maxId]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->min_id)) {
|
||||
if (isset($this->minId)) {
|
||||
switch (self::$order) {
|
||||
case 'received':
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` > ?", $this->min_id]);
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` > ?", $this->minId]);
|
||||
break;
|
||||
case 'commented':
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` > ?", $this->min_id]);
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` > ?", $this->minId]);
|
||||
break;
|
||||
case 'created':
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` > ?", $this->min_id]);
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` > ?", $this->minId]);
|
||||
break;
|
||||
case 'uriid':
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` > ?", $this->min_id]);
|
||||
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` > ?", $this->minId]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->min_id) && !isset($this->max_id)) {
|
||||
if (isset($this->minId) && !isset($this->maxId)) {
|
||||
// min_id quirk: querying in reverse order with min_id gets the most recent rows, regardless of how close
|
||||
// they are to min_id. We change the query ordering to get the expected data, and we need to reverse the
|
||||
// order of the results.
|
||||
|
@ -468,7 +468,7 @@ class Network extends Timeline
|
|||
$items = DBA::selectToArray($table, [], DBA::mergeConditions($conditionFields, $conditionStrings), $params);
|
||||
|
||||
// min_id quirk, continued
|
||||
if (isset($this->min_id) && !isset($this->max_id)) {
|
||||
if (isset($this->minId) && !isset($this->maxId)) {
|
||||
$items = array_reverse($items);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,9 +49,9 @@ class Timeline extends BaseModule
|
|||
/** @var string */
|
||||
protected $selectedTab;
|
||||
/** @var mixed */
|
||||
protected $min_id;
|
||||
protected $minId;
|
||||
/** @var mixed */
|
||||
protected $max_id;
|
||||
protected $maxId;
|
||||
/** @var string */
|
||||
protected $accountTypeString;
|
||||
/** @var int */
|
||||
|
@ -125,8 +125,8 @@ class Timeline extends BaseModule
|
|||
$this->itemUriId = 0;
|
||||
}
|
||||
|
||||
$this->min_id = $request['min_id'] ?? null;
|
||||
$this->max_id = $request['max_id'] ?? null;
|
||||
$this->minId = $request['min_id'] ?? null;
|
||||
$this->maxId = $request['max_id'] ?? null;
|
||||
|
||||
$this->noSharer = !empty($request['no_sharer']);
|
||||
}
|
||||
|
@ -139,11 +139,11 @@ class Timeline extends BaseModule
|
|||
}
|
||||
$query_parameters = [];
|
||||
|
||||
if (!empty($this->min_id)) {
|
||||
$query_parameters['min_id'] = $this->min_id;
|
||||
if (!empty($this->minId)) {
|
||||
$query_parameters['min_id'] = $this->minId;
|
||||
}
|
||||
if (!empty($this->max_id)) {
|
||||
$query_parameters['max_id'] = $this->max_id;
|
||||
if (!empty($this->maxId)) {
|
||||
$query_parameters['max_id'] = $this->maxId;
|
||||
}
|
||||
|
||||
$path_all = $path . (!empty($query_parameters) ? '?' . http_build_query($query_parameters) : '');
|
||||
|
@ -243,15 +243,15 @@ class Timeline extends BaseModule
|
|||
$condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uid` = ? AND `post-user`.`uri-id` = `post-engagement`.`uri-id`)", $this->session->getLocalUserId()]);
|
||||
}
|
||||
|
||||
if (isset($this->max_id)) {
|
||||
$condition = DBA::mergeConditions($condition, ["`created` < ?", $this->max_id]);
|
||||
if (isset($this->maxId)) {
|
||||
$condition = DBA::mergeConditions($condition, ["`created` < ?", $this->maxId]);
|
||||
}
|
||||
|
||||
if (isset($this->min_id)) {
|
||||
$condition = DBA::mergeConditions($condition, ["`created` > ?", $this->min_id]);
|
||||
if (isset($this->minId)) {
|
||||
$condition = DBA::mergeConditions($condition, ["`created` > ?", $this->minId]);
|
||||
|
||||
// Previous page case: we want the items closest to min_id but for that we need to reverse the query order
|
||||
if (!isset($this->max_id)) {
|
||||
if (!isset($this->maxId)) {
|
||||
$params['order']['created'] = false;
|
||||
}
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ class Timeline extends BaseModule
|
|||
}
|
||||
|
||||
// Previous page case: once we get the relevant items closest to min_id, we need to restore the expected display order
|
||||
if (empty($this->itemUriId) && isset($this->min_id) && !isset($this->max_id)) {
|
||||
if (empty($this->itemUriId) && isset($this->minId) && !isset($this->maxId)) {
|
||||
$items = array_reverse($items);
|
||||
}
|
||||
|
||||
|
@ -393,11 +393,11 @@ class Timeline extends BaseModule
|
|||
|
||||
// If we're looking at a "previous page", the lookup continues forward in time because the list is
|
||||
// sorted in chronologically decreasing order
|
||||
if (isset($this->min_id)) {
|
||||
$this->min_id = $items[0]['commented'];
|
||||
if (isset($this->minId)) {
|
||||
$this->minId = $items[0]['commented'];
|
||||
} else {
|
||||
// In any other case, the lookup continues backwards in time
|
||||
$this->max_id = $items[count($items) - 1]['commented'];
|
||||
$this->maxId = $items[count($items) - 1]['commented'];
|
||||
}
|
||||
|
||||
$items = $this->selectItems();
|
||||
|
@ -443,15 +443,15 @@ class Timeline extends BaseModule
|
|||
$condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uid` = ? AND `post-user`.`uri-id` = `post-thread-user-view`.`uri-id`)", $this->session->getLocalUserId()]);
|
||||
}
|
||||
|
||||
if (isset($this->max_id)) {
|
||||
$condition = DBA::mergeConditions($condition, ["`commented` < ?", $this->max_id]);
|
||||
if (isset($this->maxId)) {
|
||||
$condition = DBA::mergeConditions($condition, ["`commented` < ?", $this->maxId]);
|
||||
}
|
||||
|
||||
if (isset($this->min_id)) {
|
||||
$condition = DBA::mergeConditions($condition, ["`commented` > ?", $this->min_id]);
|
||||
if (isset($this->minId)) {
|
||||
$condition = DBA::mergeConditions($condition, ["`commented` > ?", $this->minId]);
|
||||
|
||||
// Previous page case: we want the items closest to min_id but for that we need to reverse the query order
|
||||
if (!isset($this->max_id)) {
|
||||
if (!isset($this->maxId)) {
|
||||
$params['order']['commented'] = false;
|
||||
}
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ class Timeline extends BaseModule
|
|||
}
|
||||
|
||||
// Previous page case: once we get the relevant items closest to min_id, we need to restore the expected display order
|
||||
if (empty($this->itemUriId) && isset($this->min_id) && !isset($this->max_id)) {
|
||||
if (empty($this->itemUriId) && isset($this->minId) && !isset($this->maxId)) {
|
||||
$items = array_reverse($items);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue