Project

General

Profile

Actions

Bug #3358

closed

xmera Omnia - Collection #3596: Bug fixing of several modules

Clicking on a project query resets modules and tracker to default values

Added by liaham 2 months ago. Updated 18 days ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Start date:
04/28/2025
Due date:
04/30/2025
% Done:

100%

Estimated time:
Affected Version:
Compatible Redmine Version:
6.0.z
Requires Documentation?:

Description

When a user clicks on a saved project query, modules and trackers are reset to default values. The reason is unknown so far.

Actions #1

Updated by liaham 2 months ago

  • Status changed from New to In Progress
  • Start date set to 04/28/2025
  • % Done changed from 0 to 20

This Rails method does not work with RM Project class due to the modified Project#initialize method which will set some attributes to default values.

    def becomes(klass)
      became = klass.allocate

      became.send(:initialize) do |becoming|
        @attributes.reverse_merge!(becoming.instance_variable_get(:@attributes))
        becoming.instance_variable_set(:@attributes, @attributes)
        becoming.instance_variable_set(:@mutations_from_database, @mutations_from_database ||= nil)
        becoming.instance_variable_set(:@new_record, new_record?)
        becoming.instance_variable_set(:@destroyed, destroyed?)
        becoming.errors.copy!(errors)
      end

      became
    end

The idea is to write a similar method where the Project instance will be added as method param in order to get its attributes. This should prevent the attributes to be created with the default values for enabled modules, tracker and the like.

Actions #2

Updated by liaham 2 months ago

  • Due date set to 04/30/2025
  • Status changed from In Progress to Closed
  • Priority changed from Normal to High
  • % Done changed from 20 to 100

Problem solved by using ActiveRecord::Base#init_with_attributes.

Actions #3

Updated by liaham 2 months ago

  • Target version changed from unreleased to 4.6.2
Actions #5

Updated by liaham 18 days ago

  • Parent task set to #3596
Actions

Also available in: Atom PDF