Don't change the filename of the export everytime the user is touched

closes #7622
This commit is contained in:
Benjamin Neff 2017-09-17 21:45:43 +02:00
parent ac39e920c8
commit 95fbd3fc66
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
4 changed files with 13 additions and 5 deletions

View file

@ -23,6 +23,7 @@
* Display likes and reshares without login [#7583](https://github.com/diaspora/diaspora/pull/7583)
* Fix invalid data in the database for user data export [#7614](https://github.com/diaspora/diaspora/pull/7614)
* Fix local migration run without old private key [#7558](https://github.com/diaspora/diaspora/pull/7558)
* Fix export not downloadable because the filename was resetted on access [#7622](https://github.com/diaspora/diaspora/pull/7622)
## Features
* Ask for confirmation when leaving a submittable comment field [#7530](https://github.com/diaspora/diaspora/pull/7530)

View file

@ -5,7 +5,6 @@
# the COPYRIGHT file.
class ExportedPhotos < SecureUploader
def store_dir
"uploads/users"
end
@ -13,7 +12,4 @@ class ExportedPhotos < SecureUploader
def filename
"#{model.username}_photos_#{secure_token}.zip" if original_filename.present?
end
end

View file

@ -14,6 +14,6 @@ class ExportedUser < SecureUploader
end
def filename
"#{model.username}_diaspora_data_#{secure_token}.json.gz"
"#{model.username}_diaspora_data_#{secure_token}.json.gz" if original_filename.present?
end
end

View file

@ -981,6 +981,17 @@ describe User, :type => :model do
end
end
describe "#export" do
it "doesn't change the filename when the user is saved" do
user = FactoryGirl.create(:user)
filename = user.export.filename
user.save!
expect(User.find(user.id).export.filename).to eq(filename)
end
end
describe "queue_export" do
it "queues up a job to perform the export" do
user = FactoryGirl.create(:user)