diff --git a/Gemfile b/Gemfile index 8c9a1298d..07c5c01cf 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,7 @@ gem "net-imap" gem "net-pop" gem "net-ssh", "7.0.0.beta1" # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' +gem "actioncable" gem "rails" # Use sqlite3 as the database for Active Record gem "pg" diff --git a/Gemfile.lock b/Gemfile.lock index 897729721..18ad10b10 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,29 +23,22 @@ GEM specs: aasm (5.5.0) concurrent-ruby (~> 1.0) - actioncable (7.2.1.1) - actionpack (= 7.2.1.1) - activesupport (= 7.2.1.1) + actioncable (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.1.1) - actionpack (= 7.2.1.1) - activejob (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) - mail (>= 2.8.0) - actionmailer (7.2.1.1) - actionpack (= 7.2.1.1) - actionview (= 7.2.1.1) - activejob (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionmailer (7.2.2.1) + actionpack (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activesupport (= 7.2.2.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.1.1) - actionview (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionpack (7.2.2.1) + actionview (= 7.2.2.1) + activesupport (= 7.2.2.1) nokogiri (>= 1.8.5) racc rack (>= 2.2.4, < 3.2) @@ -54,36 +47,24 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.1.1) - actionpack (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) - globalid (>= 0.6.0) - nokogiri (>= 1.8.5) - actionview (7.2.1.1) - activesupport (= 7.2.1.1) + actionview (7.2.2.1) + activesupport (= 7.2.2.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.1.1) - activesupport (= 7.2.1.1) + activejob (7.2.2.1) + activesupport (= 7.2.2.1) globalid (>= 0.3.6) - activemodel (7.2.1.1) - activesupport (= 7.2.1.1) - activerecord (7.2.1.1) - activemodel (= 7.2.1.1) - activesupport (= 7.2.1.1) + activemodel (7.2.2.1) + activesupport (= 7.2.2.1) + activerecord (7.2.2.1) + activemodel (= 7.2.2.1) + activesupport (= 7.2.2.1) timeout (>= 0.4.0) - activestorage (7.2.1.1) - actionpack (= 7.2.1.1) - activejob (= 7.2.1.1) - activerecord (= 7.2.1.1) - activesupport (= 7.2.1.1) - marcel (~> 1.0) - activesupport (7.2.1.1) + activesupport (7.2.2.1) base64 + benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) @@ -130,6 +111,7 @@ GEM bcrypt (3.1.20) bcrypt_pbkdf (1.1.1) bcrypt_pbkdf (1.1.1-x86_64-darwin) + benchmark (0.4.0) bigdecimal (3.1.8) bindex (0.8.1) bixby (5.0.2) @@ -238,6 +220,8 @@ GEM websocket-driver (>= 0.5.1) ffaker (2.23.0) ffi (1.17.0) + ffi (1.17.0-x86_64-darwin) + ffi (1.17.0-x86_64-linux-gnu) foreman (0.88.1) friendly_id (5.4.2) activerecord (>= 4.0.0) @@ -275,7 +259,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.1) + logger (1.6.2) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -293,7 +277,6 @@ GEM sinatra (~> 3.2) sqlite3 (~> 1.3) thin (~> 1.8) - marcel (1.0.4) matrix (0.4.2) method_source (1.1.0) mime-types (3.5.2) @@ -301,7 +284,7 @@ GEM mime-types-data (3.2024.0903) mini_mime (1.1.5) mini_portile2 (2.8.8) - minitest (5.25.1) + minitest (5.25.4) msgpack (1.7.2) mustermann (3.0.3) ruby2_keywords (~> 0.0.1) @@ -376,20 +359,11 @@ GEM rackup (1.0.1) rack (< 3) webrick - rails (7.2.1.1) - actioncable (= 7.2.1.1) - actionmailbox (= 7.2.1.1) - actionmailer (= 7.2.1.1) - actionpack (= 7.2.1.1) - actiontext (= 7.2.1.1) - actionview (= 7.2.1.1) - activejob (= 7.2.1.1) - activemodel (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) - bundler (>= 1.15.0) - railties (= 7.2.1.1) + rails (0.9.5) + actionmailer (>= 0.6.1) + actionpack (>= 1.4.0) + activerecord (>= 1.6.0) + rake (>= 0.4.15) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -401,9 +375,9 @@ GEM rails-html-sanitizer (1.6.1) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - railties (7.2.1.1) - actionpack (= 7.2.1.1) - activesupport (= 7.2.1.1) + railties (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -488,7 +462,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - securerandom (0.3.1) + securerandom (0.4.0) selenium-webdriver (4.24.0) base64 (~> 0.2) logger (~> 1.4) @@ -554,7 +528,7 @@ GEM concurrent-ruby (~> 1.0) unicode-display_width (2.6.0) uri (0.13.1) - useragent (0.16.10) + useragent (0.16.11) virtus (2.0.0) axiom-types (~> 0.1) coercible (~> 1.0) @@ -602,6 +576,7 @@ PLATFORMS DEPENDENCIES aasm + actioncable amazing_print aws-sdk-s3 axe-core-rspec diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fbc4e86b4..5a99d211f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,11 +1,5 @@ # frozen_string_literal: true class ApplicationController < ActionController::Base - # This is necessary only for localhost development, with storage configured for the filesystem, - # but it shouldn't cause problems in other environments that use S3. - # Including this concern lets the disk service generate URLs using - # the same host, protocol, and port as the current request. - include ActiveStorage::SetCurrent - protect_from_forgery with: :exception before_action :authenticate_user! diff --git a/config/environments/development.rb b/config/environments/development.rb index 7c6216c04..22b2713eb 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -34,9 +34,6 @@ config.cache_store = :null_store end - # Store uploaded files on amazon (see config/storage.yml for options). - config.active_storage.service = :local - config.action_mailer.perform_caching = false config.action_mailer.default_options = { diff --git a/config/environments/production.rb b/config/environments/production.rb index eda0e4604..d2ca1850f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -40,9 +40,6 @@ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local - # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 1269aaaaf..9c4abc015 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -40,9 +40,6 @@ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local - # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' diff --git a/config/environments/test.rb b/config/environments/test.rb index 38c3f9a0c..2794c90ed 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -39,9 +39,6 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - # Store uploaded files on the local file system in a temporary directory. - config.active_storage.service = :test - config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. diff --git a/spec/controllers/works_controller_spec.rb b/spec/controllers/works_controller_spec.rb index 668e7bc76..63493e1e6 100644 --- a/spec/controllers/works_controller_spec.rb +++ b/spec/controllers/works_controller_spec.rb @@ -9,7 +9,6 @@ Group.create_defaults user stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770")) - allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original stub_request(:get, /#{Regexp.escape('https://example-bucket.s3.amazonaws.com/us_covid_20')}.*\.csv/).to_return(status: 200, body: "", headers: {}) end @@ -76,7 +75,6 @@ work.reload expect(work.resource_type).to eq("Dataset") expect(work.resource_type_general).to eq("Dataset") - expect(ActiveStorage::PurgeJob).not_to have_received(:new) end it "handles the reordering the creators on the update page" do @@ -366,7 +364,6 @@ expect(saved_work.pre_curation_uploads.length).to eq(1) - expect(ActiveStorage::PurgeJob).not_to have_received(:new) expect(fake_s3_service).to have_received(:delete_s3_object).with(s3_file1.key) expect(fake_s3_service).to have_received(:delete_s3_object).with(s3_file3.key) expect(fake_s3_service).not_to have_received(:delete_s3_object).with(s3_file2.key) @@ -428,7 +425,6 @@ post :update, params: params_no_delete expect(response).to redirect_to(work_path(work)) - expect(ActiveStorage::PurgeJob).not_to have_received(:new) end end end diff --git a/spec/controllers/works_wizard_controller_spec.rb b/spec/controllers/works_wizard_controller_spec.rb index 2c08c07ad..bbe008f74 100644 --- a/spec/controllers/works_wizard_controller_spec.rb +++ b/spec/controllers/works_wizard_controller_spec.rb @@ -9,7 +9,6 @@ Group.create_defaults user stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770")) - allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original stub_request(:get, /#{Regexp.escape('https://example-bucket.s3.amazonaws.com/us_covid_20')}.*\.csv/).to_return(status: 200, body: "", headers: {}) end @@ -46,7 +45,6 @@ post(:update_wizard, params:) expect(response.status).to be 302 expect(response.location).to eq "http://test.host/works/#{work.id}/update-additional" - expect(ActiveStorage::PurgeJob).not_to have_received(:new) end context "save and stay on page" do diff --git a/spec/controllers/works_wizard_update_additonal_controller_spec.rb b/spec/controllers/works_wizard_update_additonal_controller_spec.rb index dd3db4b62..d7650fe75 100644 --- a/spec/controllers/works_wizard_update_additonal_controller_spec.rb +++ b/spec/controllers/works_wizard_update_additonal_controller_spec.rb @@ -9,7 +9,6 @@ Group.create_defaults user stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770")) - allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original stub_request(:get, /#{Regexp.escape('https://example-bucket.s3.amazonaws.com/us_covid_20')}.*\.csv/).to_return(status: 200, body: "", headers: {}) end @@ -45,7 +44,6 @@ patch(:update_additional_save, params:) expect(response.status).to be 302 expect(response.location).to eq "http://test.host/works/#{work.id}/readme-select" - expect(ActiveStorage::PurgeJob).not_to have_received(:new) end context "save and stay on page" do diff --git a/spec/system/work_edit_spec.rb b/spec/system/work_edit_spec.rb index 633aefb21..4d6db829d 100644 --- a/spec/system/work_edit_spec.rb +++ b/spec/system/work_edit_spec.rb @@ -43,7 +43,6 @@ end it "allows users to delete one of the uploads" do - allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original allow(fake_s3_service).to receive(:client_s3_files).and_return([contents1, contents2], [contents2]) expect(page).to have_content "Filename" @@ -63,7 +62,6 @@ end it "allows users to cancel the delete of one of the uploads" do - allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original allow(fake_s3_service).to receive(:client_s3_files).and_return([contents1, contents2], [contents2]) expect(page).to have_link "us_covid_2019.csv" @@ -76,7 +74,6 @@ end it "allows users to replace one of the uploads" do - allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original expect(page).to have_content "Filename" expect(page).to have_content "Last Modified" expect(page).to have_content "Size"