Skip to content

Properly save suggestions in project exports

Stan Hu requested to merge sh-fix-import-export-suggestions into master

Previously imports would fail if a merge request note included a suggestion with an ActiveRecord::HasManyThroughCantAssociateThroughHasOneOrManyReflection exception.

This was happening because suggestions were listed as a descendant of merge requests, but this doesn't work because suggestions are directly associated with notes, not merge requests, and that association is lost. Rails also disallows creating intializing a has_many association through a different object.

We fix this by making suggestions a child of notes within a merge request. This doesn't fix previously broken exported project exports, but new exports will work.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65880

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading