diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-11-07 02:03:31 +0300 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-11-07 02:03:31 +0300 |
commit | a46d32412ec93be2d6d10bd4bcbdd23b69d31865 (patch) | |
tree | b017b0a0ff5628c11a42cf5c853414b46d77be10 /app/services/users | |
parent | cb7d63f90753617920cc6f9168a48dc998dc9ee4 (diff) | |
parent | 243530360edac31f309bd3706b2d5117f6d526ad (diff) |
Merge branch 'master' into 38464-k8s-apps
Conflicts:
db/schema.rb
Diffstat (limited to 'app/services/users')
-rw-r--r-- | app/services/users/migrate_to_ghost_user_service.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/services/users/migrate_to_ghost_user_service.rb b/app/services/users/migrate_to_ghost_user_service.rb index 3a9c151cf9b..976017dfa82 100644 --- a/app/services/users/migrate_to_ghost_user_service.rb +++ b/app/services/users/migrate_to_ghost_user_service.rb @@ -25,7 +25,7 @@ module Users user.block # Reverse the user block if record migration fails - if !migrate_records && transition + if !migrate_records_in_transaction && transition transition.rollback user.save! end @@ -36,18 +36,22 @@ module Users private - def migrate_records + def migrate_records_in_transaction user.transaction(requires_new: true) do @ghost_user = User.ghost - migrate_issues - migrate_merge_requests - migrate_notes - migrate_abuse_reports - migrate_award_emojis + migrate_records end end + def migrate_records + migrate_issues + migrate_merge_requests + migrate_notes + migrate_abuse_reports + migrate_award_emojis + end + def migrate_issues user.issues.update_all(author_id: ghost_user.id) Issue.where(last_edited_by_id: user.id).update_all(last_edited_by_id: ghost_user.id) |