- Status changed to Needs work
almost 2 years ago 3:12pm 17 January 2023 - π¬π§United Kingdom jonathan1055
We also need to go the other way - when a module name is matched then display all of the permissions defined by it. Otherwise the filter is not really helpful because the actual checkboxes will not be shown. This is how it works right now, without this MR. The filter is not giving us anything useful other than allowing you to see the module names. To make changes you need to to remove the filter text.
I'm sure we can get this working so that it is useful.
- π¬π§United Kingdom jonathan1055
Now that I've added a test for the existing permissions filter, this MR should show a test failure.
- π¬π§United Kingdom jonathan1055
Good. As expected the new test (which passes on the 4.x branch) fails here, showing that the initial commit as shown in #2 causes the existing functionality to fail.
The problem is that the javascript was checking for empty text to determine if the item was a module or a permission using
item.isModule = item.text != ''
This worked fine before, because all of the permission elements returned '' for text. But now that we are selecting the permission text elements for matching, they have a text value. Hence everything was being treated as a module name. But we can simply use the element class to determine if it is a module or permission
item.isModule = item.element.has('.module').length;
This also solves the problem of the module name not showing when a permission is matched. We already have code to display the module name when the item is a permission (maybe left over from when matching on permission was attempted before? in 7.x?). So now that 'isModule' is set correctly we get the module names being shown when a permission they contain matches the input, even if the module name does not match the input. Attached is a new screengrab when filtering on 'admin'. Compare this to the screen in #2 and #6
- Status changed to Needs review
almost 2 years ago 5:33pm 23 January 2023 - π¬π§United Kingdom jonathan1055
I have also expanded the existing test to cover matching on the text of the permission.
And the placeholder now says 'Filter by module or permission' - πΊπΈUnited States smustgrave
Tested by filtering for
administer blocks and it got treated as searching for 2 words separately (which is true search to me)
Then I searched "administer block" and got just the permission for blocks
Great work!
- Status changed to Fixed
almost 2 years ago 6:58pm 23 January 2023 -
smustgrave β
committed b919a4ac on 4.x authored by
jonathan1055 β
Issue #3331723: Filter permissions on description not just module name
-
smustgrave β
committed b919a4ac on 4.x authored by
jonathan1055 β
- π¬π§United Kingdom jonathan1055
Ah, I never thought about testing for two words. Most of the work was done already, I only had to fix the
isModule
problem. Automatically closed - issue fixed for 2 weeks with no activity.