kopia lustrzana https://github.com/friendica/friendica
Supporting all parameters
rodzic
3d65ef3af2
commit
66ad777f4b
|
@ -64,7 +64,22 @@ class Conversation extends BaseApi
|
|||
|
||||
$params = ['order' => ['id' => true], 'limit' => $request['limit']];
|
||||
|
||||
$convs = DBA::select('conv', ['id'], ['uid' => $uid], $params);
|
||||
$condition = ['uid' => $uid];
|
||||
|
||||
if (!empty($request['max_id'])) {
|
||||
$condition = DBA::mergeConditions($condition, ["`id` < ?", $request['max_id']]);
|
||||
}
|
||||
|
||||
if (!empty($request['since_id'])) {
|
||||
$condition = DBA::mergeConditions($condition, ["`id` > ?", $request['since_id']]);
|
||||
}
|
||||
|
||||
if (!empty($request['min_id'])) {
|
||||
$condition = DBA::mergeConditions($condition, ["`id` > ?", $request['min_id']]);
|
||||
$params['order'] = ['id'];
|
||||
}
|
||||
|
||||
$convs = DBA::select('conv', ['id'], $condition, $params);
|
||||
|
||||
$conversations = [];
|
||||
|
||||
|
@ -72,6 +87,10 @@ class Conversation extends BaseApi
|
|||
$conversations[] = DI::mstdnConversation()->CreateFromConvId($conv['id']);
|
||||
}
|
||||
|
||||
if (!empty($request['min_id'])) {
|
||||
array_reverse($conversations);
|
||||
}
|
||||
|
||||
System::jsonExit($conversations);
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue