View Issue Details

IDProjectCategoryView StatusLast Update
0027742mantisbtfilterspublic2020-12-13 11:20
Reportermatth Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version2.24.3 
Summary0027742: "Collapse filter box by default" change from 0017830 was broken by 2.0.0
Description

Hi,

In looking at using Mantis a colleague requested the filter on the issue view be collapsed by default. In searching for how to do this I found that issue 0017830 claimed to implement that change. I was a bit baffled as to why it wasn't working and found this forum post saying how to remedy it:
https://mantisbt.org/forums/viewtopic.php?f=2&t=25298

This seemed a bit weird as the line it changed was the one added by 0017830, but then looking further using git blame I see that for 2.0.0 the collapse API changed its naming but I think it also inverted the meaning of the collapse cache token.

So in 1.3.x you used to have the function collapse_display which would return true if the cache token was set to true (so if it was false that would mean to collapse):
https://github.com/mantisbt/mantisbt/blob/master-1.3.x/core/collapse_api.php

For some reason this change set inverted that to return true from collapse_display if it was set to false (I think this change could have been part of work on 2.x.x):
https://github.com/mantisbt/mantisbt/commit/a09acdae9ea87efa01c69a7351704a39e382f87b

Then changes were applied to rework the collapse api and change collapse_display to is_collapsed which then inverted the test on the token again such that is_collapsed in 2.x would return true if the cache token was true (so if it was false that would mean to display. So I think that previous change I referenced confused things. This is the change set:
https://github.com/mantisbt/mantisbt/commit/e2aa00931d86311c91acc527a630a15639368dcb

And this, of course, is the latest state of play with is_collapsed:
https://github.com/mantisbt/mantisbt/blob/master-2.24/core/collapse_api.php

I suspect that inversion of the meaning of the cache token (which I think was accidental and caused by that intermediate inversion of the meaning) is what's behind this bug:
https://www.mantisbt.org/bugs/view.php?id=22097

And it also means that the line for 0017830 of:
$t_data['filter'] = false;

... now actually defaults the filter to being open. I don't think you could change is_collapsed to invert the meaning again as that would mean all the collapse cache tokens in use for mantis installations would cause the opposite to happen, so probably the best thing to do is change the line relating to just the filter default in collapse_api.php to be:
$t_data['filter'] = true;

Of course this change would have the side effect of meaning that filters would now be collapsed by default where as to date on 2.x.x systems they will have been expanded - it's possible some users might not be happy about that so perhaps make the $t_data['filter'] line read a setting from the config for what it uses as its default, retaining the current behaviour of setting to false (i.e. expanded by default) but allowing the config to override it?

Sorry this was a bit long winded, but I figured you might find it useful to have all the context I uncovered :).

Steps To Reproduce

Create a new user, log in as that new user from an incognito browser window (to ensure no sessions/cookies affecting things), go to view issues, observe that the filters section is expanded by default.

Additional Information

You can probably close off 0022097 now citing the explanation I've given above (but as a "don't fix" as inverting the meaning of the cache token again would affect 2.x installations, and I suspect no-one is migrating from 1.3.x to 2.x.x any more).

TagsNo tags attached.

Relationships

related to 0022097 new Inconsistent handling of collapsed sections between 1.3 and 2.0 

Activities

There are no notes attached to this issue.