diff options
| author | 2025-10-16 21:15:44 +0200 | |
|---|---|---|
| committer | 2025-10-16 21:15:44 +0200 | |
| commit | f08f7dcff988de90e899ce310246f0b552a4fe3d (patch) | |
| tree | 8a96a66aa59e3b1bf675757c5fc555e9187b8625 /app/Models/Context.php | |
| parent | ca091fbef4823159060275a293eaa4e65ecaf1c0 (diff) | |
Sort by article length (#8119)
* Sort by article length
fix https://github.com/FreshRSS/Extensions/issues/378
Very basic using simply SQL `LENGTH()` function.
<img width="492" height="217" alt="image" src="https://github.com/user-attachments/assets/7cf37303-76c8-4411-b8b1-075e81535b60" />
* Improve content length retrieval
Diffstat (limited to 'app/Models/Context.php')
| -rw-r--r-- | app/Models/Context.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/Models/Context.php b/app/Models/Context.php index c0e25dffd..8cd78c779 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -42,7 +42,7 @@ final class FreshRSS_Context { public static int $state = 0; /** @var 'ASC'|'DESC' */ public static string $order = 'DESC'; - /** @var 'id'|'c.name'|'date'|'f.name'|'link'|'title'|'rand'|'lastUserModified' */ + /** @var 'id'|'c.name'|'date'|'f.name'|'link'|'title'|'rand'|'lastUserModified'|'length' */ public static string $sort = 'id'; public static int $number = 0; public static int $offset = 0; @@ -252,7 +252,7 @@ final class FreshRSS_Context { $order = Minz_Request::paramString('order', true) ?: FreshRSS_Context::userConf()->sort_order; self::$order = in_array($order, ['ASC', 'DESC'], true) ? $order : 'DESC'; $sort = Minz_Request::paramString('sort', true) ?: FreshRSS_Context::userConf()->sort; - self::$sort = in_array($sort, ['id', 'c.name', 'date', 'f.name', 'link', 'title', 'rand', 'lastUserModified'], true) ? $sort : 'id'; + self::$sort = in_array($sort, ['id', 'c.name', 'date', 'f.name', 'link', 'title', 'rand', 'lastUserModified', 'length'], true) ? $sort : 'id'; self::$number = Minz_Request::paramInt('nb') ?: FreshRSS_Context::userConf()->posts_per_page; if (self::$number > FreshRSS_Context::userConf()->max_posts_per_rss) { self::$number = max( |
