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

closes #7622
parent ac39e920
......@@ -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)
......
......@@ -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
......@@ -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
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment