Defect #33733

No trackers are selected for new projects

Added by Yuichi HARADA about 1 year ago. Updated 6 months ago.

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

0%

Category:Projects
Target version:4.2.0
Resolution:Fixed Affected version:

Description

Immediately after installing Redmine, the initial display of the trackers on Administration > Settings > Projects > [Default trackers for new projects] is unchecked.

However, even if the screen display is the same, the behavior is different immediately after installing Redmine and after saving.
  • Immediately after installing Redmine:
    All trackers are enabled when you create a new project.
  • After saving on Administration > Settings > Projects (trackers remains checked off):
    All trackers are disabled when you create a new project.

administration-settings-projects.png (169 KB) Yuichi HARADA, 2020-07-15 07:26

fix-33733.patch Magnifier (1.13 KB) Yuichi HARADA, 2020-07-15 07:38

patch-33733.patch Magnifier (1.61 KB) Marius BALTEANU, 2021-03-18 22:50

apply-patch.png (28 KB) Yuichi HARADA, 2021-03-23 03:01

Associated revisions

Revision 20841
Added by Go MAEDA 6 months ago

Set trackers in the default data as defaults for new projects (#33733).

Patch by Marius BALTEANU.

History

#1 Updated by Yuichi HARADA about 1 year ago

The following patch will solve the problem.

diff --git a/app/models/project.rb b/app/models/project.rb
index 0119b1228..aba2ef4b5 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -122,7 +122,7 @@ class Project < ActiveRecord::Base
       self.enabled_module_names = Setting.default_projects_modules
     end
     if !initialized.key?('trackers') && !initialized.key?('tracker_ids')
-      default = Setting.default_projects_tracker_ids
+      default = Setting.default_projects_tracker_ids.presence
       if default.is_a?(Array)
         self.trackers = Tracker.where(:id => default.map(&:to_i)).sorted.to_a
       else

#2 Updated by Go MAEDA about 1 year ago

  • Status changed from New to Confirmed
  • Assignee set to Jean-Philippe Lang
  • Target version set to 4.2.0

#3 Updated by Go MAEDA about 1 year ago

I assigned this issue to Jean-Philippe Lang because the patch introduces a bit bigger behavior change that changes the existing test.

#4 Updated by Marius BALTEANU 6 months ago

Default trackers are not part of the default Redmine settings (settings.yml), are part of the default data which is not necessary applied on all new instances.

From my point of view, to fix this, we should add Setting.default_projects_tracker_ids as part of the default data (when the trackers are added). Please try with the attached patch and let me know what do you think.

#5 Updated by Marius BALTEANU 6 months ago

  • Assignee changed from Jean-Philippe Lang to Yuichi HARADA

#6 Updated by Yuichi HARADA 6 months ago

Marius BALTEANU wrote:

Default trackers are not part of the default Redmine settings (settings.yml), are part of the default data which is not necessary applied on all new instances.

From my point of view, to fix this, we should add Setting.default_projects_tracker_ids as part of the default data (when the trackers are added). Please try with the attached patch and let me know what do you think.

Thank you for creating the patch.

Comfirmed the your patch. I think the patch is good.
When I imported the default data as follows, "Default trackers for new projects" were properly checked on.

$ bundle exec rake db:migrate:reset
$ bundle exec rake redmine:load_default_data

#7 Updated by Marius BALTEANU 6 months ago

  • Assignee changed from Yuichi HARADA to Go MAEDA

#8 Updated by Go MAEDA 6 months ago

  • Subject changed from Tracker does not work after creating a new project to No trackers are selected for new projects
  • Status changed from Confirmed to Closed
  • Resolution set to Fixed

Committed the fix. Thank you.

Also available in: Atom PDF