diff --git a/app/models/medium.rb b/app/models/medium.rb index 05fc8ccb5..238d421f5 100644 --- a/app/models/medium.rb +++ b/app/models/medium.rb @@ -55,19 +55,19 @@ def url_for_format(format) end end - def put_url + def put_url(opts = {}) if external_link src else - MediaStorage.put_path(src, indifferent_attributes) + MediaStorage.put_path(src, indifferent_attributes.merge(opts)) end end - def get_url + def get_url(opts = {}) if external_link src else - MediaStorage.get_path(src, indifferent_attributes) + MediaStorage.get_path(src, indifferent_attributes.merge(opts)) end end diff --git a/app/views/classification_data_mailer/classification_data.html.erb b/app/views/classification_data_mailer/classification_data.html.erb index b240b5778..4e2398154 100644 --- a/app/views/classification_data_mailer/classification_data.html.erb +++ b/app/views/classification_data_mailer/classification_data.html.erb @@ -1,3 +1,3 @@

Classification data for <%= @project.display_name %> is ready

-

Click to download your data. This link will be valid for 1 hour.

+

Click to download your data. This link will be valid for 24 hours.

diff --git a/app/views/classification_data_mailer/classification_data.text.erb b/app/views/classification_data_mailer/classification_data.text.erb index 200951c9a..adbab8bb7 100644 --- a/app/views/classification_data_mailer/classification_data.text.erb +++ b/app/views/classification_data_mailer/classification_data.text.erb @@ -1,3 +1,3 @@ Classification data for <%= @project.display_name %> is ready -Download at <%= @url %>. This link will be valid for 1 hour. +Download at <%= @url %>. This link will be valid for 24 hours. diff --git a/app/views/subject_data_mailer/subject_data.html.erb b/app/views/subject_data_mailer/subject_data.html.erb index 8cebe1770..cf16fa366 100644 --- a/app/views/subject_data_mailer/subject_data.html.erb +++ b/app/views/subject_data_mailer/subject_data.html.erb @@ -1,4 +1,3 @@

Subject data for <%= @project.display_name %> is ready

-

Click to download your data. This link will be valid for 1 hour.

- +

Click to download your data. This link will be valid for 24 hours.

diff --git a/app/views/subject_data_mailer/subject_data.text.erb b/app/views/subject_data_mailer/subject_data.text.erb index 9fd1ff1ee..87b69aa92 100644 --- a/app/views/subject_data_mailer/subject_data.text.erb +++ b/app/views/subject_data_mailer/subject_data.text.erb @@ -1,3 +1,3 @@ Subject data for <%= @project.display_name %> is ready -Download at <%= @url %>. This link will be valid for 1 hour. +Download at <%= @url %>. This link will be valid for 24 hours. diff --git a/app/workers/concerns/dump_worker.rb b/app/workers/concerns/dump_worker.rb index cff5587f6..d89d7948b 100644 --- a/app/workers/concerns/dump_worker.rb +++ b/app/workers/concerns/dump_worker.rb @@ -67,7 +67,7 @@ def emails end def send_email - mailer.perform_async(@project.id, medium.get_url, emails) + mailer.perform_async(@project.id, medium.get_url(get_expires: 24*60), emails) end def to_gzip diff --git a/spec/models/medium_spec.rb b/spec/models/medium_spec.rb index b3babb429..dfb8fa201 100644 --- a/spec/models/medium_spec.rb +++ b/spec/models/medium_spec.rb @@ -89,6 +89,11 @@ .with(anything, be_a(HashWithIndifferentAccess)) medium.put_url end + + it 'should pass opts to MediaStorage' do + expect(MediaStorage).to receive(:put_path).with(anything, hash_including('foo' => 'bar')) + medium.put_url(foo: 'bar') + end end context "when externally linked" do @@ -111,6 +116,11 @@ .with(anything, be_a(HashWithIndifferentAccess)) medium.get_url end + + it 'should pass opts to MediaStorage' do + expect(MediaStorage).to receive(:get_path).with(anything, hash_including('foo' => 'bar')) + medium.get_url(foo: 'bar') + end end context "when externally linked" do