Defect #26023

Category filter only shows categories of current project

Added by Felix Schäfer over 1 year ago. Updated 22 days ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues filter
Target version:4.0.0
Resolution: Affected version:

Description

The category filter currently only shows the categories of the current project, this means the global query can not use categories, and projects with subprojects can not use the categories from the subproject as filters.

I will provide a patch shortly to solve this issue.

26023.patch Magnifier (2.78 KB) Felix Schäfer, 2017-05-23 13:13

26023-screenshot@2x.png (27.8 KB) Go MAEDA, 2017-05-23 13:29

26023_test_added.patch Magnifier (5.64 KB) Takenori TAKAKI, 2018-09-26 06:47

26023_tests_visibility_fix.patch Magnifier (7.31 KB) Felix Schäfer, 2018-10-01 21:37

category_filter.patch Magnifier (4.63 KB) Jean-Philippe Lang, 2018-10-11 19:09


Related issues

Related to Redmine - Feature #8192: Make a global category filter available from issues list ... New 2011-04-19
Related to Redmine - Feature #17761: Add freetext category filter to issue query when listing ... New
Related to Redmine - Defect #23198: Group by Category does not group across projects New
Related to Redmine - Patch #26091: Allow to filter by any visible version on the global issu... Closed
Related to Redmine - Feature #6793: Report for issues with no category for all projects New 2010-11-02
Duplicated by Redmine - Defect #8854: Filter on category across subprojects does not work New 2011-07-19

History

#1 Updated by Felix Schäfer over 1 year ago

Please note that this patch does not differentiate between categories from different projects with the same name. It is also not possible currently to filter by a string match on the name of the category currently.

#2 Updated by Felix Schäfer over 1 year ago

A quick word regarding the rationale: in #25501#note-4 custom fields were changed to behave in the way implemented in the proposed patch, i.e. only limit the categories to the categories of the current project and its subprojects if we are in a project context.

#3 Updated by Go MAEDA over 1 year ago

Interesting. Thank you for submitting the patch.

#4 Updated by Go MAEDA over 1 year ago

I think we can merge this patch if tests are added.

#5 Updated by Go MAEDA over 1 year ago

The patch also resolves #8192, #17761 and #23198.

#6 Updated by Toshi MARUYAMA over 1 year ago

  • Related to Feature #8192: Make a global category filter available from issues list at All Issues level added

#7 Updated by Toshi MARUYAMA over 1 year ago

  • Related to Feature #17761: Add freetext category filter to issue query when listing issues of more than one project added

#8 Updated by Toshi MARUYAMA over 1 year ago

  • Related to Defect #23198: Group by Category does not group across projects added

#9 Updated by Go MAEDA over 1 year ago

  • Duplicated by Defect #8854: Filter on category across subprojects does not work added

#10 Updated by Toshi MARUYAMA over 1 year ago

  • Related to Patch #26091: Allow to filter by any visible version on the global issues view added

#11 Updated by Go MAEDA over 1 year ago

  • Related to Feature #6793: Report for issues with no category for all projects added

#12 Updated by Takenori TAKAKI about 1 month ago

I think this feature is very useful.
I have added a test code to the patch.
I am looking forward to this feature availabled!

#13 Updated by Go MAEDA about 1 month ago

  • Status changed from New to Needs feedback
  • Assignee set to Felix Schäfer

I would like Felix to review the patch 26023_test_added.patch.

#14 Updated by Felix Schäfer about 1 month ago

Takaki-san thank you very much for your tests, I have been able to integrate them in my patch. I hope you will be mentioned as author of this patch too.

I have reworked two small syntax details in the patch. I have also noticed a visibility issue in the first version of my patch. The category filter on the issue list in an issue would show the categories of all subprojects, even if the current user did not have the permission to see them. The updated patch attached to this comment contains a fix and a test for this issue.

#15 Updated by Takenori TAKAKI about 1 month ago

Thank you for reviewing, Felix.
I also did't notice the visibility caused by permission.
I confirmed that the new patch(26023_test_added.patch) works fine and passes the tests!

#16 Updated by Go MAEDA about 1 month ago

  • Status changed from Needs feedback to New
  • Assignee changed from Felix Schäfer to Go MAEDA
  • Target version changed from Candidate for next major release to 4.0.0

I think we can deliver this in 4.0.0.

#17 Updated by Jeremy Bailey about 1 month ago

With this change, will there be a way of enabling the legacy behavior? My team uses Category as a hack to allow non-admin users to maintain their own list of people who initiate work with them, most of whom are not Redmine users. What makes categories special is that the admins don’t have to edit values that are possible, unlike custom fields.

So for us, it wouldn’t be good if every project showed categories for every project (subprojects might be okay). If the categories in other projects could be shown or hidden depending on a setting, or if the cagetories in the main project can be shown first with a separator before the others in a project context (sort of like how custom fields are grouped in the issue filter), the system would be more flexible.

#18 Updated by Felix Schäfer about 1 month ago

There is no setting, no.

Currently the category filter on a project's issue list will show only the categories of the current project. On the global issue list there is currently no category filter.

With the patch, the global issue list will have a category filter with all categories from the projects the current user has access to. On a project's issue list it will show all the categories of the current project as well as categories from subprojects the current user has access to.

#19 Updated by Go MAEDA about 1 month ago

  • Assignee deleted (Go MAEDA)

#20 Updated by Jeremy Bailey about 1 month ago

Thanks, Felix.

On a project's issue list it will show all the categories of the current project as well as categories from subprojects the current user has access to.

Thanks for clarifying. Is it possible to display the categories of the current project first, then a separator before any categories found within subprojects?

#21 Updated by Jean-Philippe Lang about 1 month ago

When reading at all the related issues, we can see that it's pretty common to have the same category in multiple projects (eg. Security), even if they are different records from a database point of view (since we can't share categories across projects).

With the proposed patch, we would have a category filter filled with multiple Security values. And if you filter on one of these values, you will only get the security issues of a single project. That's not what is expected. I think we should filter by category names, eg. being able to list all issues with the Security category. Also, when grouping by category, all Security issues should appear under the same group (#23198).

I have a patch that implements this solution, please let me know what you think.

#22 Updated by Marius BALTEANU about 1 month ago

Jean-Philippe Lang wrote:

When reading at all the related issues, we can see that it's pretty common to have the same category in multiple projects (eg. Security), even if they are different records from a database point of view (since we can't share categories across projects).

With the proposed patch, we would have a category filter filled with multiple Security values. And if you filter on one of these values, you will only get the security issues of a single project. That's not what is expected. I think we should filter by category names, eg. being able to list all issues with the Security category. Also, when grouping by category, all Security issues should appear under the same group (#23198).

I have a patch that implements this solution, please let me know what you think.

I’m in favour of your proposed solution.

I have only one concern regarding the filter behavior which will be different than other filters like Target version and I’m asking if is not better to add this feature as a new filter named “Category name”. In this way, if we add in the future the posibility to share category between projects (feature requested by many users in #5358) it will not be necessary to revert the behavior of the current Category filter.

On the same topic, a user requested in #27192 to filter the target version by name and not by id (I mention this because is somehow related).

#23 Updated by Yuuki NARA about 1 month ago

The current 'version' has functions that inherit in subprojects and make them available in all projects.

I think the same processing (inheritance) is good for versions and categories and projects.
I believe that the inheritance process of the current version is simple and user-friendly.

On Redmine 3.4.6, I put the same processing as version on category.
(I just made the category the same code as the version.)

http://www.redmine.org/issues/5358#note-97
http://www.redmine.org/issues/5358#note-98

The current user data can be used as it is.
If inheritance is set for the category definition, it can be used from subprojects as well.

#24 Updated by Go MAEDA about 1 month ago

The patch seems to be controversial. Is it better to put off implementing this feature until 4.1.0?

#25 Updated by Felix Schäfer 22 days ago

Jean-Philippe Lang wrote:

When reading at all the related issues, we can see that it's pretty common to have the same category in multiple projects (eg. Security), even if they are different records from a database point of view (since we can't share categories across projects).

With the proposed patch, we would have a category filter filled with multiple Security values. And if you filter on one of these values, you will only get the security issues of a single project. That's not what is expected. I think we should filter by category names, eg. being able to list all issues with the Security category. Also, when grouping by category, all Security issues should appear under the same group (#23198).

I have a patch that implements this solution, please let me know what you think.

I'm really not sure that having the "normal" Category filter be name- instead of ID-specific would be a good idea, as this would make the filter work differently from all other filters. If there's multiple users called "Jean Dupont", the search by author will yield only results for one user, not for all users with that name. This change would make the Category filter behave differently from the other filters.

Regarding the ability to search by Categories with the same name in different projects: This would already be possible by using the multi-match filter (expand the dropdown with the possible values to a list, select all categories with the name to search). I agree this wouldn't be as easy as matching on the name, but this would at least not make the filter work differently from all other filters.

Note that I am not opposed to be able to filter by the name of the Category instead of by the ID, but this would need to be a different filter or a new operator, to 1. still be able to search by ID if this is what the user needs, and 2. avoid differing behaviour for same-looking filters (subtly different results for things "looking" the same is always difficult to explain to new users and difficult for them to remember).

One thing that could be improved in my patch proposal in #26023#note-14 would be to group categories by project or to prepend the category name with the project name. It currently wouldn't be possible to distinguish between categories with the same name in different projects in the list. If this is something of interest I could prepare an updated patch.

Also available in: Atom PDF