Milestones are reopened when a project with closed group milestones is transferred between groups

Summary

Project transfer: milestones are reopened when a project with closed group milestones is transferred between groups.

Steps to reproduce

  • create a project test-project01 in group test-group-01
  • create some milestones on the group level in test-group-01: release-1.1 and release-1.2
  • create issues and merge requests in the project test-project01 and assign milestones to them
  • close both group milestones
  • create another group test-group02 and group milestones there: release-2.1 and release-2.2
  • transfer the project test-project01 to test-group02
  • check the status of the old milestones assigned to issues MRs: both of them were converted to project milestones, and both of them are back in open status

What is the current bug behavior?

Milestones are reopened when a project with closed group milestones is transferred between groups.

What is the expected correct behavior?

Milestones should remain closed when a project with closed group milestones is transferred between groups.

Relevant logs and/or screenshots

n/a

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

System information
System:   Debian 10
Proxy:    no
Current User: git
Using RVM:  no
Ruby Version: 2.7.5p203
Gem Version:  3.1.4
Bundler Version:2.3.15
Rake Version: 13.0.6
Redis Version:  6.2.7
Sidekiq Version:6.4.0
Go Version: unknown

GitLab information
Version:  15.1.0-ee
Revision: 31c24d2d864
Directory:  /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 12.10
URL:    https://gitlabhost.tld
HTTP Clone URL: https://gitlabhost.tld/some-group/some-project.git
SSH Clone URL:  git@gitlabhost.tld:some-group/some-project.git
Elasticsearch:  no
Geo:    no
Using LDAP: yes
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version:  14.7.4
Repository storage paths:
- default:  /var/opt/gitlab/git-data/repositories
GitLab Shell path:    /opt/gitlab/embedded/service/gitlab-shell

Possible fixes

n/a

Additional information

The issue has been found by one of our Ultimate customers: internal ZD ticket, also mentioned in #366479 (closed).

Edited by Alexandr Tanayno