]> git.openstreetmap.org Git - rails.git/commitdiff
Defer deletion of avatars to a background job
authorTom Hughes <tom@compton.nu>
Tue, 16 Jul 2019 07:27:14 +0000 (08:27 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 16 Jul 2019 07:27:14 +0000 (08:27 +0100)
app/controllers/users_controller.rb
app/models/user.rb

index 8c234006e4477172d457eeb583928b8872256e79..9c918fee751c1e77e59fe92b3f98efe8ca673acd 100644 (file)
@@ -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
 
index 13248e4fb4c4136273b3b2028fe272bbdfea6a12..8e3ac17caf0b96b93401ad4d6d81ff495945c687 100644 (file)
@@ -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 = ""