Supporting all parameters

pull/10276/head
Michael 2021-05-19 22:33:40 +00:00
rodzic 3d65ef3af2
commit 66ad777f4b
1 zmienionych plików z 20 dodań i 1 usunięć

Wyświetl plik

@ -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);
}
}