Rake users:merge fails to delete user with small posts

When attempting to merge users accounts, twice now the merge has failed to complete properly as the user has small posts which are not deleted. In both cases I’ve encountered the small posts were invites in an email, meaning the user CC’d others when writing an email.

Error:

rake users:merge['user_A','user_B']
rake aborted!
UserDestroyer::PostsExistError: UserDestroyer::PostsExistError
/var/www/discourse/app/services/user_destroyer.rb:18:in `destroy'
/var/www/discourse/app/services/user_merger.rb:360:in `delete_source_user'
/var/www/discourse/app/services/user_merger.rb:22:in `merge!'
/var/www/discourse/lib/tasks/users.rake:48:in `block in <top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => users:merge
(See full trace by running task with --trace)

cc @gerhard

3 Likes

This was a regression. It’s fixed.

https://github.com/discourse/discourse/commit/f8ded9cec9255a297d988b821dc596e133d86d78

3 Likes