diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-09-07 13:39:20 +0000 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2018-09-07 13:39:20 +0000 |
commit | d95c1f0335f7309114fcbb0d5413b28e1701a640 (patch) | |
tree | 6b22580a79dd1f929aecd158c31706ce3870c39b /app/services/issues | |
parent | 81f4dc059db91577f72134e6008680b72029a29e (diff) | |
download | gitlab-ce-d95c1f0335f7309114fcbb0d5413b28e1701a640.tar.gz |
Use ResourceLabelEvent for tracking label changes
Diffstat (limited to 'app/services/issues')
-rw-r--r-- | app/services/issues/move_service.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb index 841bce9949e..c52aa577dd8 100644 --- a/app/services/issues/move_service.rb +++ b/app/services/issues/move_service.rb @@ -36,6 +36,7 @@ module Issues def update_new_issue rewrite_notes + copy_resource_label_events rewrite_issue_award_emoji add_note_moved_from end @@ -96,6 +97,18 @@ module Issues end end + def copy_resource_label_events + @old_issue.resource_label_events.find_in_batches do |batch| + events = batch.map do |event| + event.attributes + .except('id', 'reference', 'reference_html') + .merge('issue_id' => @new_issue.id, 'created_at' => event.created_at) + end + + Gitlab::Database.bulk_insert(ResourceLabelEvent.table_name, events) + end + end + def rewrite_issue_award_emoji rewrite_award_emoji(@old_issue, @new_issue) end |