From: Tom Hughes Date: Tue, 16 Jul 2019 07:27:14 +0000 (+0100) Subject: Defer deletion of avatars to a background job X-Git-Tag: live~3018 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/905a7eadb622761b3c752a113ca878faa316a37a Defer deletion of avatars to a background job --- diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8c234006e..9c918fee7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -665,10 +665,10 @@ class UsersController < ApplicationController user.avatar.attach(params[:user][:avatar]) user.image_use_gravatar = false when "delete" then - user.avatar.purge + user.avatar.purge_later user.image_use_gravatar = false when "gravatar" then - user.avatar.purge + user.avatar.purge_later user.image_use_gravatar = true end diff --git a/app/models/user.rb b/app/models/user.rb index 13248e4fb..8e3ac17ca 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -269,7 +269,7 @@ class User < ActiveRecord::Base ## # delete a user - leave the account but purge most personal data def delete - avatar.purge + avatar.purge_later self.display_name = "user_#{id}" self.description = ""