Skip to content

Fix categories sorting - #2616

Merged
Alkarex merged 1 commit into
FreshRSS:devfrom
flusio:fix/categories-sorting
Oct 31, 2019
Merged

Alkarex merged 1 commit into
FreshRSS:devfrom
flusio:fix/categories-sorting

Conversation

@marienfressinaud

Copy link
Copy Markdown
Member

I had a bug when some articles in a category were unread. Sometimes,
filtering the category displayed all the articles, even with the "Adjust
showing" option.

A reasonably good guess was to look the last commits that impacted the
categories and, indeed, it was introduced by the new category sorting
system.

The sort function (usort) doesn't keep the index association, which is
important here. I must admit I don't understand exactly why (I didn't
search), but the keys are probably used somewhere. Another fix would be
to not rely on these keys anymore.

The bug was introduced in 042fcd5

I had a bug when some articles in a category were unread. Sometimes,
filtering the category displayed all the articles, even with the "Adjust
showing" option.

A reasonably good guess was to look the last commits that impacted the
categories and, indeed, it was introduced by the new category sorting
system.

The sort function (`usort`) doesn't keep the index association, which is
important here. I must admit I don't understand exactly why (I didn't
search), but the keys are probably used somewhere. Another fix would be
to not rely on these keys anymore.

The bug was introduced in 042fcd5

- Ref PR: FreshRSS#2592
- Ref usort: https://www.php.net/manual/en/function.usort.php
- Ref uasort: https://www.php.net/manual/en/function.uasort.php
@Alkarex Alkarex added this to the 1.15.0 milestone Oct 31, 2019

@Frenzie Frenzie left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks.

@Alkarex
Alkarex merged commit 4058898 into FreshRSS:dev Oct 31, 2019
@Alkarex

Alkarex commented Oct 31, 2019

Copy link
Copy Markdown
Member

It would be nice to find the details of the problem

@Alkarex

Alkarex commented Oct 31, 2019

Copy link
Copy Markdown
Member

Ah, sure, the keys were the category ID, and usort broke that.

$list[$key] = $cat;

Used e.g. by:

self::$current_get['category'] = $id;
if (!isset(self::$categories[$id])) {

@marienfressinaud
marienfressinaud deleted the fix/categories-sorting branch October 31, 2019 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants