X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/11cc4a5e601dd288d601e6e35a72d159062f18b5..c5fc9f0e7e93088c599ae0d8540ee0117f277d6d:/app/models/user.rb?ds=sidebyside diff --git a/app/models/user.rb b/app/models/user.rb index 1d0089599..13248e4fb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -85,6 +85,8 @@ class User < ActiveRecord::Base scope :active, -> { where(:status => %w[active confirmed]) } scope :identifiable, -> { where(:data_public => true) } + has_one_attached :avatar + has_attached_file :image, :default_url => "/assets/:class/:attachment/:style.png", :styles => { :large => "100x100>", :small => "50x50>" } @@ -267,6 +269,8 @@ class User < ActiveRecord::Base ## # delete a user - leave the account but purge most personal data def delete + avatar.purge + self.display_name = "user_#{id}" self.description = "" self.home_lat = nil @@ -277,6 +281,7 @@ class User < ActiveRecord::Base self.auth_provider = nil self.auth_uid = nil self.status = "deleted" + save end