Skip to content
This repository was archived by the owner on Apr 10, 2023. It is now read-only.
This repository was archived by the owner on Apr 10, 2023. It is now read-only.

Broken issue copy functionality #228

@martincizek

Description

@martincizek

When an issue with children is copied, the parent-child relation is lost.

Steps to reproduce:

  • Install redmine_tags
  • Create issue A with child issue B
  • Use "Copy" on issue A and submit
  • New issues A2 and B2 are created, but A2 is not a parent of B2

This issue is also detected by two of core Redmine tests:

  1. Error:
    IssuesControllerTest#test_create_as_copy_to_a_different_project_should_copy_subtask_custom_fields:
    ActiveRecord::StaleObjectError: Attempted to update a stale object: Issue.
        app/models/issue.rb:222:in `create_or_update'
        plugins/redmine_tags/lib/redmine_tags/hooks/model_issue_hook.rb:18:in `controller_issues_new_after_save'
        lib/redmine/hook.rb:66:in `block (2 levels) in call_hook'
        lib/redmine/hook.rb:66:in `each'
        lib/redmine/hook.rb:66:in `block in call_hook'
        lib/redmine/hook.rb:63:in `tap'
        lib/redmine/hook.rb:63:in `call_hook'
        lib/redmine/hook.rb:96:in `call_hook'
        app/controllers/issues_controller.rb:150:in `create'
        lib/redmine/sudo_mode.rb:61:in `sudo_mode'
        test/functional/issues_controller_test.rb:5383:in `block in test_create_as_copy_to_a_different_project_should_copy_subtask_custom_fields'
        test/functional/issues_controller_test.rb:5382:in `test_create_as_copy_to_a_different_project_should_copy_subtask_custom_fields'
    
    
    bin/rails test test/functional/issues_controller_test.rb:5378
    
  2. Error:
    IssuesControllerTest#test_create_as_copy_should_copy_subtasks:
    ActiveRecord::StaleObjectError: Attempted to update a stale object: Issue.
        app/models/issue.rb:222:in `create_or_update'
        plugins/redmine_tags/lib/redmine_tags/hooks/model_issue_hook.rb:18:in `controller_issues_new_after_save'
        lib/redmine/hook.rb:66:in `block (2 levels) in call_hook'
        lib/redmine/hook.rb:66:in `each'
        lib/redmine/hook.rb:66:in `block in call_hook'
        lib/redmine/hook.rb:63:in `tap'
        lib/redmine/hook.rb:63:in `call_hook'
        lib/redmine/hook.rb:96:in `call_hook'
        app/controllers/issues_controller.rb:150:in `create'
        lib/redmine/sudo_mode.rb:61:in `sudo_mode'
        test/functional/issues_controller_test.rb:5358:in `block in test_create_as_copy_should_copy_subtasks'
        test/functional/issues_controller_test.rb:5357:in `test_create_as_copy_should_copy_subtasks'
    
    
    bin/rails test test/functional/issues_controller_test.rb:5353
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions