mirror of
https://github.com/friendica/friendica
synced 2025-04-19 05:50:10 +00:00
Add common relationship methods to Model\ContactRelation
- Introduce DBA::mergeConditions method - Replace GContact relationship method contents with Model\ContactRelation method calls
This commit is contained in:
parent
a6a23802b7
commit
24a82110fd
5 changed files with 425 additions and 117 deletions
|
@ -143,7 +143,7 @@ abstract class ContactEndpoint extends BaseApi
|
|||
$previous_cursor = 0;
|
||||
$total_count = 0;
|
||||
if (!$hide_friends) {
|
||||
$condition = DBA::collapseCondition([
|
||||
$condition = [
|
||||
'rel' => $rel,
|
||||
'uid' => $uid,
|
||||
'self' => false,
|
||||
|
@ -151,17 +151,15 @@ abstract class ContactEndpoint extends BaseApi
|
|||
'hidden' => false,
|
||||
'archive' => false,
|
||||
'pending' => false
|
||||
]);
|
||||
];
|
||||
|
||||
$total_count = DBA::count('contact', $condition);
|
||||
|
||||
if ($cursor !== -1) {
|
||||
if ($cursor > 0) {
|
||||
$condition[0] .= " AND `id` > ?";
|
||||
$condition[] = $cursor;
|
||||
$condition = DBA::mergeConditions($condition, ['`id` > ?', $cursor]);
|
||||
} else {
|
||||
$condition[0] .= " AND `id` < ?";
|
||||
$condition[] = -$cursor;
|
||||
$condition = DBA::mergeConditions($condition, ['`id` < ?', -$cursor]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue