Possible sort bug

I’ve been using tt-rss for quite a while and am a fan. I think I’ve spotted a sort bug…

When I sort by Oldest First in the tt-rss web app it appears to sort by Added date, but when I sort by Newest first it sorts by Updated date. In this case, the sort by Newest is the correct one.

To replicate, I added an RSS source with articles from 1 week and 3 weeks ago and I am viewing the parent folder with all the RSS sources within it. This collection contains lots of articles across the last 5 weeks. When I sort by Oldest, the sort order is wrong. It sorts then from the moment I added the source. When I sort by Newest, it does it correctly.

git commit id = 05a47e5cf4d1044f2ff8861298a8050c124451b4)
tt-rss version v20.08-05a47e5cf

Server env = Ubuntu 20.04, PHP 7.4,6.

currently only newest first sorts by actual feed-provided timestamp, everything else uses batch timestamp first.

i think it makes sense for newest first / oldest first to work consistently though, if newest first relies on feed timestamp, then oldest first should work the same but in reverse.

https://git.tt-rss.org/fox/tt-rss/commit/48be0057744944432aab6f0235068250f96f0a8e

I updated the Sorting wiki page with this change.

I just updated to commit 48be0057744944432aab6f0235068250f96f0a8e .

Well, can you guys make an option to recover the old “old first” sorting?

I use it very often, espcially when I want to view lots of old posts but high score posts first, old “old first” is very helpful.

I didn’t think it’s bug, I thought that was a good feature before.

just tested on latest release… looks good to me. Thanks.

i just knew someone wouldn’t like this change. i think the current way makes sense though, previous behavior wasn’t exactly intuitive (especially the difference between newest / oldest and score taken into account sometimes).

unfortunately those are not currently pluggable but i can make a note to see if plugin-controlled sorting could be implemented.

oh cool, thanks. i’ve completely forgotten that this page exists.

Thanks for the reply.

I know this change is needed and make old first meanful.

I have gone back to the old commit and wait for “plugin-controlled sorting” if it is possible in the future.

this adds support for pluggable custom sorting - https://git.tt-rss.org/fox/tt-rss/commit/ddf9227dc48faf7effbf3bf263aa271f35d74c43

a plugin should look like this (this particular example restores legacy oldest first):

<?php
/*
	-> plugins.local/legacy_oldest_first/init.php
*/
class Legacy_Oldest_First extends Plugin {

	function init($host) {
		$host->add_hook($host::HOOK_HEADLINES_CUSTOM_SORT_MAP, $this);
		$host->add_hook($host::HOOK_HEADLINES_CUSTOM_SORT_OVERRIDE, $this);
	}

	function hook_headlines_custom_sort_map() {
		return [
			"dates_reverse_legacy" => "Oldest first (legacy)"
		];
	}

	function hook_headlines_custom_sort_override($order) {
		if ($order == "dates_reverse_legacy") {
			return [ "score DESC, updated", true ];
		} else {
			return [ "", false ];
		}
	}

	function about() {
		return array(1.0,
			"Oldest first also takes score into account",
			"fox",
			false,
			"");
	}

	function api_version() {
		return 2;
	}

}

Hmz, this looks like something that suggests a rewrite of FeedMei/init.js at master · ltGuillaume/FeedMei · GitHub unless I can’t get Feeds.getUnread(feed, isCat) yet at the point in time this new hook is triggered.

a plugin should look like this (this particular example restores legacy oldest first):

Thanks. Browser client is fine.
perhaps you have a solution for Android client?

for android (and API clients in general) above plugin should override dates_reverse directly instead of trying to add a separate sort order variant.

i’ve reworked core code so that plugins may override built in sort order instead of only being able to add new ones:

https://git.tt-rss.org/fox/tt-rss/commit/a922b3cc6de3c63fb1d4abe9049d2d6bc5616250

sorry for the delay.