1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Partial implementation of article sorting

This commit is contained in:
J. King 2021-02-01 22:11:15 -05:00
parent 007183450a
commit 9d7ada7f59

View file

@ -924,7 +924,25 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
} elseif ($status === ["unread"]) { } elseif ($status === ["unread"]) {
$c->hidden(false)->unread(true); $c->hidden(false)->unread(true);
} }
$articles = Arsse::$db->articleList(Arsse::$user->id, $c, self::ARTICLE_COLUMNS); $desc = $query['direction'] === "desc" ? " desc" : "";
if ($query['order'] === "id") {
$order = ["id".$desc];
} elseif ($query['order'] === "status") {
if (!$desc) {
$order = ["hidden", "unread desc"];
} else {
$order = ["hidden desc", "unread"];
}
} elseif ($query['order'] === "published_at") {
$order = ["modified_date".$desc];
} elseif ($query['order'] === "category_title") {
$order = []; // TODO
} elseif ($query['order'] === "catgory_id") {
$order = []; //TODO
} else {
$order = [];
}
$articles = Arsse::$db->articleList(Arsse::$user->id, $c, self::ARTICLE_COLUMNS, $order);
} }
public static function tokenGenerate(string $user, string $label): string { public static function tokenGenerate(string $user, string $label): string {