Feature #29449

Filter out issues from closed projects in My Page blocks

Added by Maxim Krušina 3 months ago. Updated 19 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:My page
Target version:4.0.0
Resolution:Fixed

Description

Users see issues assigned to them on My Page, even when the project is closed.
So it's difficult because someone with rights to open/close project needs to re-open project, close affected issues (or change Assignee) and then close project again.
I think that the best solution is NOT to display issues of closed projects on the user's My Page.

29449-not-display-closed-project_issues.patch Magnifier (1.88 KB) Yuichi HARADA, 2018-10-02 07:03

29449-not-display-closed-project_issues-functional-test.patch Magnifier (4.85 KB) Yuichi HARADA, 2018-10-02 07:04

0003-Filter-our-issues-from-closed-projects-in-the-follow.patch Magnifier (6.99 KB) Marius BALTEANU, 2018-10-22 00:14

use_status_active_constant.diff Magnifier (1.86 KB) Marius BALTEANU, 2018-10-29 07:33


Related issues

Duplicated by Redmine - Feature #17006: Hide issues from closed project on my page Closed
Blocked by Redmine - Feature #20081: Filter issues and time entries by project status Closed

Associated revisions

Revision 17611
Added by Go MAEDA 19 days ago

Filter out issues from closed projects in the following widgets (#29449):

  • Issues assigned to me
  • Reported issues
  • Watched issues

Patch by Marius BALTEANU.

Revision 17612
Added by Go MAEDA 19 days ago

Use Project::STATUS_ACTIVE constant instead of harcoded 1 (#29449).

Patch by Marius BALTEANU.

History

#1 Updated by Max Johansson 3 months ago

+1 (╯ಠ_ಠ)╯︵ ┻━┻

#2 Updated by zhangzhi liao 3 months ago

+1

#3 Updated by zhangzhi liao 3 months ago

I think add project statues column on Issues can solve this issue!

#4 Updated by Go MAEDA 3 months ago

  • Duplicated by Feature #17006: Hide issues from closed project on my page added

#5 Updated by Marius BALTEANU 2 months ago

  • Tracker changed from Defect to Feature

zhangzhi liao wrote:

I think add project statues column on Issues can solve this issue!

Agree. If #29482 is implemented, we can add the projects status filter to Issues and then we can filter out the issues from closed projects on my page.

I'm changing the tracker to feature because is not a defect, issues from closed projects are shown also in the Issues page by default.

#6 Updated by Maxim Krušina about 1 month ago

I think it's more complicated and there should be more discussion on this topic. The main question is what exactly the closing of projects means. From my point of view - when the project is closed, it's already solved, done. For that reason, the project will disappear from the project list (in the default view). And because the this "disappearing logic" it seems obvious that tickets will disappear also. Of course, there can be a filter, which is a great idea, but the default behaviour should be the same as for the project:
  • Project open = show everything
  • Project closed = hide project from project list (you can show closed project by using a filter) + hide tickets from users (tickets can be shown by using the filter)

It's not just my point of view, we take care of more Redmine installations in different companies and with the current logic, there is a lot of people fighting. Generally, the project manager will close the project and the rest of the team is complaining they still see obsolete tickets.

#7 Updated by Marius BALTEANU about 1 month ago

Maxim Krušina wrote:

I think it's more complicated and there should be more discussion on this topic. The main question is what exactly the closing of projects means. From my point of view - when the project is closed, it's already solved, done. For that reason, the project will disappear from the project list (in the default view). And because the this "disappearing logic" it seems obvious that tickets will disappear also. Of course, there can be a filter, which is a great idea, but the default behaviour should be the same as for the project:
  • Project open = show everything
  • Project closed = hide project from project list (you can show closed project by using a filter) + hide tickets from users (tickets can be shown by using the filter)

It's not just my point of view, we take care of more Redmine installations in different companies and with the current logic, there is a lot of people fighting. Generally, the project manager will close the project and the rest of the team is complaining they still see obsolete tickets.

Maxim, I think I was not clear enough in my previous comment. What I wanted to say is that I'm totally in favour of filtering out the issues from closed projects by default in the "Issues assigned to me", "Watched issues" and "Reported issues" widgets from My Page and also, from the issues list. In order to do it without rewriting the current implementation of the widgets, we need first to have the possibility to filter issues after project status. My plan is to add these features after I finish my work on #29482.

Regarding the issues list, my main concern is related to the "Project status" filter, if we should add it by default to the issues filters (like "Status" is open) or we should just hide the issues from closed project. Somehow, I find the first solution less confusing for users even if we add an extra row to issues filters.

#8 Updated by Yuichi HARADA about 1 month ago

If #29482 was not considered, I think that it will be solved by changing it as follows.

diff --git a/app/helpers/my_helper.rb b/app/helpers/my_helper.rb
index 8320749fc..bdda8302f 100644
--- a/app/helpers/my_helper.rb
+++ b/app/helpers/my_helper.rb
@@ -96,6 +96,8 @@ module MyHelper
   def render_issuesassignedtome_block(block, settings)
     query = IssueQuery.new(:name => l(:label_assigned_to_me_issues), :user => User.current)
     query.add_filter 'assigned_to_id', '=', ['me']
+    query.add_available_filter('project.status', :type => :integer)
+    query.add_filter 'project.status', '=', ["#{Project::STATUS_ACTIVE}"]
     query.column_names = settings[:columns].presence || ['project', 'tracker', 'status', 'subject']
     query.sort_criteria = settings[:sort].presence || [['priority', 'desc'], ['updated_on', 'desc']]
     issues = query.issues(:limit => 10)
@@ -106,6 +108,8 @@ module MyHelper
   def render_issuesreportedbyme_block(block, settings)
     query = IssueQuery.new(:name => l(:label_reported_issues), :user => User.current)
     query.add_filter 'author_id', '=', ['me']
+    query.add_available_filter('project.status', :type => :integer)
+    query.add_filter 'project.status', '=', ["#{Project::STATUS_ACTIVE}"]
     query.column_names = settings[:columns].presence || ['project', 'tracker', 'status', 'subject']
     query.sort_criteria = settings[:sort].presence || [['updated_on', 'desc']]
     issues = query.issues(:limit => 10)
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index c342dc456..2bd334bb4 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -543,6 +543,10 @@ class IssueQuery < Query
     end
   end

+  def sql_for_project_status_field(field, operator, value)
+    '(' + sql_for_field(field, operator, value, Project.table_name, "status") + ')'
+  end
+
   def sql_for_relations(field, operator, value, options={})
     relation_options = IssueRelation::TYPES[field]
     return relation_options unless relation_options

#9 Updated by Marius BALTEANU about 1 month ago

Thanks Yuichi for working on this. Yes, it should work, but it is not enough because users will have inconsistent results between the issues returned by the widgets and the issues returned in the Issues list when they click on the widgets title (because the project status is not available in Issues filters).

I've already started to extract some code from #29482 in order to implement this ticket and the Project's Status as available filter in Issues list (#12066). I'll post them very soon.

#10 Updated by Marius BALTEANU 26 days ago

  • Related to Feature #20081: Filter issues and time entries by project status added

#11 Updated by Marius BALTEANU 26 days ago

  • Related to deleted (Feature #20081: Filter issues and time entries by project status)

#12 Updated by Marius BALTEANU 26 days ago

  • Blocked by Feature #20081: Filter issues and time entries by project status added

#13 Updated by Marius BALTEANU 26 days ago

Here is the patch that adds this change. It should be applied on top of the patches from #20081.

#14 Updated by Marius BALTEANU 19 days ago

  • Target version set to Candidate for next major release

#15 Updated by Go MAEDA 19 days ago

  • Subject changed from Issues from closed projects are displayed on user's My Page to Filter out issues from closed projects in My Page blocks
  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Target version changed from Candidate for next major release to 4.0.0
  • Resolution set to Fixed

Committed the patch posted by Marius. Thanks.

#16 Updated by Marius BALTEANU 19 days ago

Go Maeda, please apply the attached patch in order to use the Project::STATUS_ACTIVE instead of harcoded 1.

#17 Updated by Go MAEDA 19 days ago

  • Status changed from Reopened to Closed

Marius BALTEANU wrote:

Go Maeda, please apply the attached patch in order to use the Project::STATUS_ACTIVE instead of harcoded 1.

Done (r17612).

#18 Updated by Marius BALTEANU 19 days ago

Go MAEDA wrote:

Marius BALTEANU wrote:

Go Maeda, please apply the attached patch in order to use the Project::STATUS_ACTIVE instead of harcoded 1.

Done (r17612).

Thanks.

Also available in: Atom PDF