Delete archive files when closing an account

closes #7684
This commit is contained in:
Janakas 2017-12-28 23:04:06 +01:00 committed by Dennis Schubert
parent d4e5d13a8f
commit 0347507b20
No known key found for this signature in database
GPG key ID: 5A0304BEA7966D7E
3 changed files with 18 additions and 2 deletions

View file

@ -1,6 +1,7 @@
# 0.7.3.0
## Refactor
* Work on the data downloads: Fixed general layout of buttons, added a timestamp and implemented auto-deletion of old exports [#7684](https://github.com/diaspora/diaspora/pull/7684)
## Bug fixes
* Fix notifications when people remove their birthday date [#7691](https://github.com/diaspora/diaspora/pull/7691)

View file

@ -539,6 +539,8 @@ class User < ApplicationRecord
:post_default_public].each do |field|
self[field] = false
end
self.remove_export = true
self.remove_exported_photos_file = true
self[:disable_mail] = true
self[:strip_exif] = true
self[:email] = "deletedaccount_#{self[:id]}@example.org"
@ -579,7 +581,7 @@ class User < ApplicationRecord
attributes.keys - %w(id username encrypted_password created_at updated_at locked_at
serialized_private_key getting_started
disable_mail show_community_spotlight_in_stream
strip_exif email remove_after export exporting exported_at
exported_photos_file exporting_photos exported_photos_at)
strip_exif email remove_after export exporting
exported_photos_file exporting_photos)
end
end

View file

@ -944,6 +944,17 @@ describe User, :type => :model do
expect(@user.reload.show_community_spotlight_in_stream).to be false
expect(@user.reload.post_default_public).to be false
end
it "removes export archives" do
@user.perform_export!
@user.perform_export_photos!
@user.clear_account!
@user.reload
expect(@user.export).not_to be_present
expect(@user.exported_at).to be_nil
expect(@user.exported_photos_file).not_to be_present
expect(@user.exported_photos_at).to be_nil
end
end
describe "#clearable_attributes" do
@ -970,6 +981,8 @@ describe User, :type => :model do
last_seen
color_theme
post_default_public
exported_at
exported_photos_at
)
)
end