Patch #32109

Obey sub-task sharing settings on new issue creation

Added by Andrey Galkin about 2 years ago. Updated 13 days ago.

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

0%

Category:Issues
Target version:-

Description

There have been previous efforts to improve sub-task management, but they lack support for cross-project sharing setting.

Below is a patch which has been tested manually. Some extra test case are desired, but I would be unable to help more unfortunately.

Index: app/models/issue.rb
===================================================================
--- app/models/issue.rb (revision 18330)
+++ app/models/issue.rb (working copy)
@@ -1509,7 +1509,18 @@
   # Returns a scope of projects that user can assign the issue to
   def allowed_target_projects(user=User.current, context=nil)
     if new_record? && context.is_a?(Project) && !copy?
-      current_project = context.self_and_descendants
+      case Setting.cross_project_subtasks
+      when 'system'
+        current_project = nil
+      when 'tree'
+        current_project = context.root.self_and_descendants
+      when 'hierarchy'
+        current_project = context.hierarchy
+      when 'descendants'
+        current_project = context.self_and_descendants
+      else
+        current_project = nil
+      end
     elsif new_record?
       current_project = nil
     else

obey-subtask-settings.patch Magnifier (880 Bytes) Andrey Galkin, 2019-09-22 07:32

obey-subtask-settings-411.patch Magnifier - Applies the settings of the sub-task to a new issue in 4.1.1 (1006 Bytes) Vincent VIGNOLLE, 2021-04-12 10:08

obey-subtask-settings-411.patch Magnifier (1.11 KB) Vincent VIGNOLLE, 2021-04-12 10:58


Related issues

Related to Redmine - Feature #12704: Allow selecting subprojects on new issue form Closed

History

#1 Updated by Andrey Galkin about 2 years ago

Attaching the patch as file as description got screwed.

#2 Updated by Go MAEDA about 2 years ago

  • Description updated (diff)

#3 Updated by Vincent VIGNOLLE 8 months ago

Here is the adaptation to 4.1.1 of this very useful patch.
It applies the settings of the sub-task to a new issue ( « Allow cross-project issue relations » ).

#4 Updated by Vincent VIGNOLLE 8 months ago

Here is the adaptation to 4.1.1 of this very useful patch.
It applies the settings of the sub-task to a new issue ( « Allow cross-project issue relations » ).

#5 Updated by Go MAEDA 6 months ago

  • Related to Feature #12704: Allow selecting subprojects on new issue form added

#6 Updated by Go MAEDA 6 months ago

I think this issue was fixed in Redmine 4.2 by #33419. Could you test with Redmine 4.2?

#7 Updated by Vincent VIGNOLLE 13 days ago

Yes, I confirm !

Also available in: Atom PDF