diff options
author | Janakas <janakas@coding4.coffee> | 2017-12-29 01:04:06 +0300 |
---|---|---|
committer | Dennis Schubert <mail@dennis-schubert.de> | 2018-01-08 23:15:41 +0300 |
commit | 0347507b2030e17889f90c810c3e224487beb9ef (patch) | |
tree | 820e90d891e39ddd94a4b29130bb65d07b37c29f | |
parent | d4e5d13a8fb9185be1a678fdc2e185573a7b6ee9 (diff) |
Delete archive files when closing an account
closes #7684
-rw-r--r-- | Changelog.md | 1 | ||||
-rw-r--r-- | app/models/user.rb | 6 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 13 |
3 files changed, 18 insertions, 2 deletions
diff --git a/Changelog.md b/Changelog.md index 5703fe50b..60c8b62f1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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) diff --git a/app/models/user.rb b/app/models/user.rb index ac16de682..e6fa252be 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 913e3c735..d264493a8 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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 |