diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfb009ec2a..35eeb5a772 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7.3 + ruby-version: 3.3.5 bundler-cache: true - name: Install dependencies run: | diff --git a/.ruby-version b/.ruby-version index 2c9b4ef42e..9c25013dbb 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.3 +3.3.6 diff --git a/Gemfile b/Gemfile index 4d6280a94b..c44990e2b9 100644 --- a/Gemfile +++ b/Gemfile @@ -2,17 +2,20 @@ source 'https://rubygems.org' -ruby '2.7.3' +ruby '3.3.5' -gem 'rails', '6.1.7.6' +gem 'rails', '~> 7.2.1' gem 'capistrano', '~> 3.10', require: false gem 'capistrano-bundler', '~> 1.6' gem 'capistrano-rails', '~> 1.4', require: false +gem 'html-pipeline', '~> 2.14' gem 'importmap-rails' gem 'jquery-rails' gem 'jquery-ui-sass-rails' gem 'mysql2' +gem 'net-pop', github: 'ruby/net-pop' +gem 'nkf' gem 'nokogiri' gem 'postmark-rails' gem 'recaptcha', require: 'recaptcha/rails' @@ -21,7 +24,7 @@ gem 'ruby-openai' gem 'rvm1-capistrano3', require: false gem 'savon', '~> 2.12.0' gem 'text' -gem 'thredded', '~> 1.0' +gem 'thredded', '~> 1.1' gem 'will_paginate' gem 'acts_as_list' @@ -44,8 +47,8 @@ gem 'oink' gem 'pry' gem 'iiif-image-api', git: 'https://github.com/samvera-labs/iiif-image-api.git', branch: 'main' -gem 'iiif-presentation', git: 'https://github.com/benwbrum/osullivan', branch: 'service_is_array' -gem 'riiif', git: 'https://github.com/BrumfieldLabs/riiif.git', branch: 'quote-paths-for-shell' +gem 'iiif-presentation' +gem 'riiif' gem 'omniauth', '~> 1.9.2' gem 'omniauth-google-oauth2' @@ -63,7 +66,7 @@ gem 'active_link_to' gem 'warning' gem 'http_accept_language' -gem 'rails-i18n', '~> 6.0.0' +gem 'rails-i18n', '~> 7.0.0' gem 'charlock_holmes' gem 'forty_facets' @@ -75,10 +78,6 @@ gem 'terser' gem 'interactor-rails', '~> 2.0' -group :assets do - gem 'uglifier' -end - group :test do gem 'capybara' gem 'database_cleaner' @@ -119,7 +118,7 @@ gem 'autoprefixer-rails' gem 'slim' # Gravatar Image Tag -gem 'gravatar_image_tag' +gem 'gravatar_image_tag', github: 'Tinix/gravatar_image_tag' # Admin masquerade as a user gem 'devise_masquerade', '~> 1.2.0' diff --git a/Gemfile.lock b/Gemfile.lock index 90817fee3a..bfedc1bb46 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,125 +1,133 @@ GIT - remote: https://github.com/BrumfieldLabs/riiif.git - revision: 2b9ca620a83a24980e4fcd2c227b55b6a6d096d4 - branch: quote-paths-for-shell + remote: https://github.com/Tinix/gravatar_image_tag.git + revision: e2a51e54b1971640110c4d6ed951eb14e2b26851 specs: - riiif (2.3.0) - deprecation (>= 1.0.0) - iiif-image-api (>= 0.1.0) - railties (>= 4.2, < 7) + gravatar_image_tag (1.2.0) GIT remote: https://github.com/bentonow/bento-ruby-sdk.git - revision: 61b92ce00fd29d0601c96344f26b1ef412be442c + revision: 6b59479c157b26364e653fd04f72307d88d521f8 branch: master specs: - bento-sdk (0.1.0) + bento-sdk (0.5.0) + faraday (>= 0.14) GIT - remote: https://github.com/benwbrum/osullivan - revision: 814ac4ddabb2423de9d7e4f6b2dc8d8153317903 - branch: service_is_array + remote: https://github.com/ruby/net-pop.git + revision: e8d0afe2773b9eb6a23c39e9e437f6fc0fc7c733 specs: - iiif-presentation (0.2.0) - activesupport (>= 3.2.18) - faraday (>= 0.9) - json + net-pop (0.1.2) + net-protocol GIT remote: https://github.com/samvera-labs/iiif-image-api.git - revision: 2097a48df5f8b75a394311c083cfd2aed7b900bb + revision: d69f260baee18f5a2a97ae9dea8e2fb1a43e8be7 branch: main specs: - iiif-image-api (0.2.0) + iiif-image-api (0.3.0) activesupport GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.6) - actionpack (= 6.1.7.6) - activesupport (= 6.1.7.6) + actioncable (7.2.2) + actionpack (= 7.2.2) + activesupport (= 7.2.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.6) - actionpack (= 6.1.7.6) - activejob (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) - mail (>= 2.7.1) - actionmailer (6.1.7.6) - actionpack (= 6.1.7.6) - actionview (= 6.1.7.6) - activejob (= 6.1.7.6) - activesupport (= 6.1.7.6) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.7.6) - actionview (= 6.1.7.6) - activesupport (= 6.1.7.6) - rack (~> 2.0, >= 2.0.9) + zeitwerk (~> 2.6) + actionmailbox (7.2.2) + actionpack (= 7.2.2) + activejob (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) + mail (>= 2.8.0) + actionmailer (7.2.2) + actionpack (= 7.2.2) + actionview (= 7.2.2) + activejob (= 7.2.2) + activesupport (= 7.2.2) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.2) + actionview (= 7.2.2) + activesupport (= 7.2.2) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.2) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.6) - actionpack (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.2) + actionpack (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.6) - activesupport (= 6.1.7.6) + actionview (7.2.2) + activesupport (= 7.2.2) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) active_link_to (1.0.5) actionpack addressable active_record_union (1.3.0) activerecord (>= 4.0) - activejob (6.1.7.6) - activesupport (= 6.1.7.6) + activejob (7.2.2) + activesupport (= 7.2.2) globalid (>= 0.3.6) - activemodel (6.1.7.6) - activesupport (= 6.1.7.6) - activerecord (6.1.7.6) - activemodel (= 6.1.7.6) - activesupport (= 6.1.7.6) - activestorage (6.1.7.6) - actionpack (= 6.1.7.6) - activejob (= 6.1.7.6) - activerecord (= 6.1.7.6) - activesupport (= 6.1.7.6) + activemodel (7.2.2) + activesupport (= 7.2.2) + activerecord (7.2.2) + activemodel (= 7.2.2) + activesupport (= 7.2.2) + timeout (>= 0.4.0) + activestorage (7.2.2) + actionpack (= 7.2.2) + activejob (= 7.2.2) + activerecord (= 7.2.2) + activesupport (= 7.2.2) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (6.1.7.6) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (7.2.2) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) - acts_as_list (1.1.0) - activerecord (>= 4.2) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + acts_as_list (1.2.4) + activerecord (>= 6.1) + activesupport (>= 6.1) acts_as_tree (2.9.1) activerecord (>= 3.0.0) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) - ahoy_matey (4.2.1) - activesupport (>= 5.2) - device_detector - safely_block (>= 0.2.1) - airbrussh (1.5.2) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + ahoy_matey (5.2.1) + activesupport (>= 6.1) + device_detector (>= 1) + safely_block (>= 0.4) + airbrussh (1.5.3) sshkit (>= 1.6.1, != 1.7.0) ajax-datatables-rails (1.0.0) railties (>= 4.2) - akami (1.3.2) + akami (1.3.3) + base64 gyoku (>= 0.4.0) nokogiri - annotaterb (4.9.0) + annotaterb (4.13.0) ast (2.4.2) - autoprefixer-rails (10.4.16.0) + autoprefixer-rails (10.4.19.0) execjs (~> 2) awesome_print (1.9.2) babel-source (5.8.35) @@ -128,29 +136,23 @@ GEM execjs (~> 2.0) base64 (0.2.0) bcrypt (3.1.20) + benchmark (0.4.0) better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) rouge (>= 1.0.0) - better_html (2.0.2) - actionview (>= 6.0) - activesupport (>= 6.0) - ast (~> 2.0) - erubi (~> 1.4) - parser (>= 2.4) - smart_properties - bigdecimal (3.1.7) + bigdecimal (3.1.8) binding_of_caller (1.0.1) debug_inspector (>= 1.2.0) - bootsnap (1.18.3) + bootsnap (1.18.4) msgpack (~> 1.2) browser (2.7.1) - builder (3.2.4) - bullet (7.1.6) + builder (3.3.0) + bullet (8.0.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) - capistrano (3.18.1) + capistrano (3.19.2) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) @@ -160,11 +162,11 @@ GEM capistrano-rails (1.6.3) capistrano (~> 3.1) capistrano-bundler (>= 1.1, < 3) - capybara (3.39.2) + capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) @@ -176,28 +178,31 @@ GEM image_processing (~> 1.1) marcel (~> 1.0.0) ssrf_filter (~> 1.0) - charlock_holmes (0.7.7) - childprocess (5.0.0) + charlock_holmes (0.7.9) + childprocess (5.1.0) + logger (~> 1.5) clipboard-rails (1.7.1) coderay (1.1.3) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) crack (1.0.0) bigdecimal rexml crass (1.0.6) - database_cleaner (2.0.2) + csv (3.3.0) + database_cleaner (2.1.0) database_cleaner-active_record (>= 2, < 3) - database_cleaner-active_record (2.1.0) + database_cleaner-active_record (2.2.0) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - date (3.3.4) + date (3.4.0) db_text_search (1.0.0) activerecord (>= 4.1.15) debug_inspector (1.2.0) deprecation (1.1.0) activesupport - device_detector (1.0.7) + device_detector (1.1.3) devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -210,69 +215,71 @@ GEM devise (>= 4.7.0) railties (>= 5.2.0) diff-lcs (1.5.1) - diffy (3.4.2) - docile (1.4.0) - dotenv (2.8.1) - dotenv-rails (2.8.1) - dotenv (= 2.8.1) - railties (>= 3.2) + diffy (3.4.3) + docile (1.4.1) + dotenv (3.1.4) + dotenv-rails (3.1.4) + dotenv (= 3.1.4) + railties (>= 6.1) + drb (2.2.1) easy_translate (0.5.1) thread thread_safe - edtf (3.1.1) - activesupport (>= 3.0, < 8.0) + edtf (3.2.0) + activesupport (>= 3.0, < 9.0) edtf-humanize (2.2.0) activesupport (>= 4) edtf (>= 2.3, < 4) roman (~> 0.2.0) - errbase (0.2.2) - erubi (1.12.0) + erubi (1.13.0) event_stream_parser (1.0.0) - execjs (2.9.1) - factory_bot (6.4.5) + execjs (2.10.0) + factory_bot (6.5.0) activesupport (>= 5.0.0) - factory_bot_rails (6.4.3) - factory_bot (~> 6.4) + factory_bot_rails (6.4.4) + factory_bot (~> 6.5) railties (>= 5.0.0) - faraday (2.8.1) - base64 - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) + faraday (2.12.1) + faraday-net_http (>= 2.0, < 3.5) + json + logger faraday-multipart (1.0.4) multipart-post (~> 2) - faraday-net_http (3.0.2) - ffi (1.16.3) + faraday-net_http (3.4.0) + net-http (>= 0.5.0) + ffi (1.17.0) flamegraph (0.9.5) forty_facets (0.2.1) friendly_id (5.5.1) activerecord (>= 4.0.0) + geo_coord (0.2.0) globalid (1.2.1) activesupport (>= 6.1) - gravatar_image_tag (1.2.0) gyoku (1.4.0) builder (>= 2.1.2) rexml (~> 3.0) - hashdiff (1.1.0) + hashdiff (1.1.2) hashie (5.0.0) - highline (2.1.0) + highline (3.1.1) + reline hodel_3000_compliant_logger (0.1.1) html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) htmlentities (4.3.4) http_accept_language (2.1.1) - httparty (0.21.0) + httparty (0.22.0) + csv mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) httpi (2.5.0) rack socksify - i18n (1.14.4) + i18n (1.14.6) concurrent-ruby (~> 1.0) - i18n-tasks (1.0.13) + i18n-tasks (1.0.14) activesupport (>= 4.0.2) ast (>= 2.1.0) - better_html (>= 1.0, < 3.0) erubi highline (>= 2.0.0) i18n @@ -280,21 +287,31 @@ GEM rails-i18n rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) - image_processing (1.12.2) + iiif-presentation (1.3.0) + activesupport (>= 3.2.18) + faraday (~> 2.7) + geo_coord + json + image_processing (1.13.0) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) importmap-rails (2.0.3) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) - inline_svg (1.9.0) + inline_svg (1.10.0) activesupport (>= 3.0) nokogiri (>= 1.6) interactor (3.1.2) - interactor-rails (2.2.1) + interactor-rails (2.3.0) interactor (~> 3.0) - rails (>= 4.2) - iso-639 (0.3.6) + railties (>= 7.0) + io-console (0.7.2) + irb (1.14.1) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + iso-639 (0.3.8) + csv jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -306,8 +323,8 @@ GEM jquery-rails jquery-ui-rails (= 4.0.3) railties (>= 3.1.0) - json (2.7.2) - jwt (2.8.1) + json (2.8.2) + jwt (2.9.3) base64 kaminari (1.2.2) activesupport (>= 4.1.0) @@ -321,17 +338,18 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - kramdown (2.4.0) - rexml + kramdown (2.5.1) + rexml (>= 3.3.9) kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - launchy (3.0.0) + launchy (3.0.1) addressable (~> 2.8) childprocess (~> 5.0) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.22.0) + logger (1.6.1) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -341,27 +359,27 @@ GEM net-smtp marcel (1.0.4) matrix (0.4.2) - memory_profiler (1.0.1) - meta_request (0.8.2) + memory_profiler (1.1.0) + meta_request (0.8.5) rack-contrib (>= 1.1, < 3) - railties (>= 3.0.0, < 8) + railties (>= 3.0.0, < 9) method_source (1.1.0) - mini_magick (4.12.0) + mini_magick (4.13.2) mini_mime (1.1.5) - mini_portile2 (2.8.7) - minitest (5.22.3) - msgpack (1.7.2) + mini_portile2 (2.8.8) + minitest (5.25.2) + msgpack (1.7.5) multi_json (1.15.0) - multi_xml (0.6.0) - multipart-post (2.4.0) + multi_xml (0.7.1) + bigdecimal (~> 3.1) + multipart-post (2.4.1) mustache (1.1.1) - mutex_m (0.2.0) mysql2 (0.5.6) - net-imap (0.4.10) + net-http (0.5.0) + uri + net-imap (0.5.1) date net-protocol - net-pop (0.1.2) - net-protocol net-protocol (0.2.2) timeout net-scp (4.0.0) @@ -370,13 +388,15 @@ GEM net-ssh (>= 5.0.0, < 8.0.0) net-smtp (0.5.0) net-protocol - net-ssh (7.2.3) - newrelic_rpm (9.13.0) - nio4r (2.7.1) - nokogiri (1.15.6) + net-ssh (7.3.0) + newrelic_rpm (9.16.0) + nio4r (2.7.4) + nkf (0.2.0) + nokogiri (1.16.7) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nori (2.6.0) + nori (2.7.1) + bigdecimal oauth2 (1.4.11) faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) @@ -412,10 +432,11 @@ GEM sanitize open3 (0.2.1) orm_adapter (0.5.0) - parser (3.3.0.5) + ostruct (0.6.1) + parser (3.3.6.0) ast (~> 2.4.1) racc - pkg-config (1.5.6) + pkg-config (1.5.8) postmark (1.25.1) json postmark-rails (0.22.1) @@ -430,16 +451,18 @@ GEM pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) - public_suffix (5.0.5) - puma (6.4.2) + psych (5.2.0) + stringio + public_suffix (6.0.1) + puma (6.5.0) nio4r (~> 2.0) - pundit (2.3.1) + pundit (2.4.0) activesupport (>= 3.0.0) racc (1.8.1) - rack (2.2.9) + rack (2.2.10) rack-attack (6.7.0) rack (>= 1.0, < 4) - rack-contrib (2.4.0) + rack-contrib (2.5.0) rack (< 4) rack-mini-profiler (3.3.1) rack (>= 1.2.0) @@ -448,23 +471,27 @@ GEM rack-reverse-proxy (0.12.0) rack (>= 1.0.0) rack-proxy (~> 0.6, >= 0.6.1) + rack-session (1.0.2) + rack (< 3) rack-test (2.1.0) rack (>= 1.3) - rails (6.1.7.6) - actioncable (= 6.1.7.6) - actionmailbox (= 6.1.7.6) - actionmailer (= 6.1.7.6) - actionpack (= 6.1.7.6) - actiontext (= 6.1.7.6) - actionview (= 6.1.7.6) - activejob (= 6.1.7.6) - activemodel (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.2.2) + actioncable (= 7.2.2) + actionmailbox (= 7.2.2) + actionmailer (= 7.2.2) + actionpack (= 7.2.2) + actiontext (= 7.2.2) + actionview (= 7.2.2) + activejob (= 7.2.2) + activemodel (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) bundler (>= 1.15.0) - railties (= 6.1.7.6) - sprockets-rails (>= 2.0.0) + railties (= 7.2.2) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -476,69 +503,78 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - rails-i18n (6.0.0) + rails-i18n (7.0.10) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 7) + railties (>= 6.0.0, < 8) rails_gravatar (1.0.4) actionview - railties (6.1.7.6) - actionpack (= 6.1.7.6) - activesupport (= 6.1.7.6) - method_source + railties (7.2.2) + actionpack (= 7.2.2) + activesupport (= 7.2.2) + irb (~> 1.13) + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) - recaptcha (5.16.0) - regexp_parser (2.9.0) + rdoc (6.8.1) + psych (>= 4.0.0) + recaptcha (5.17.0) + regexp_parser (2.9.2) + reline (0.5.11) + io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.3.7) + rexml (3.3.9) + riiif (2.6.0) + deprecation (>= 1.0.0) + iiif-image-api (>= 0.1.0) + railties (>= 4.2, < 8) rinku (2.0.6) - rmagick (5.5.0) + rmagick (6.0.1) observer (~> 0.1) pkg-config (~> 1.4) roman (0.2.0) - rouge (4.2.1) - rspec-core (3.13.0) + rouge (4.5.1) + rspec-core (3.13.2) rspec-support (~> 3.13.0) - rspec-expectations (3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.0) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (6.1.2) - actionpack (>= 6.1) - activesupport (>= 6.1) - railties (>= 6.1) + rspec-rails (7.1.0) + actionpack (>= 7.0) + activesupport (>= 7.0) + railties (>= 7.0) rspec-core (~> 3.13) rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) rtl (0.6.0) - ruby-openai (6.5.0) + ruby-openai (7.3.1) event_stream_parser (>= 0.3.0, < 2.0.0) faraday (>= 1) faraday-multipart (>= 1) ruby-saml (1.17.0) nokogiri (>= 1.13.10) rexml - ruby-vips (2.2.1) + ruby-vips (2.2.2) ffi (~> 1.12) - ruby2_keywords (0.0.5) + logger rubyzip (2.3.2) rvm1-capistrano3 (1.4.0) capistrano (~> 3.0) sshkit (>= 1.2) - safely_block (0.3.0) - errbase (>= 0.1.1) - sanitize (6.1.0) + safely_block (0.4.1) + sanitize (6.1.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) sassc (2.4.0) @@ -557,7 +593,10 @@ GEM nokogiri (>= 1.8.1) nori (~> 2.4) wasabi (~> 3.4) - selenium-webdriver (4.9.0) + securerandom (0.3.2) + selenium-webdriver (4.27.0) + base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -571,13 +610,12 @@ GEM docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) slim (5.2.1) temple (~> 0.10.0) tilt (>= 2.1.0) - smart_properties (1.17.0) socksify (1.7.1) sprockets (4.2.1) concurrent-ruby (~> 1.0) @@ -586,25 +624,26 @@ GEM babel-source (>= 5.8.11) babel-transpiler sprockets (>= 3.0.0) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - sshkit (1.22.1) + sshkit (1.23.2) base64 - mutex_m net-scp (>= 1.1.2) net-sftp (>= 2.1.2) net-ssh (>= 2.8.0) - ssrf_filter (1.1.2) + ostruct + ssrf_filter (1.2.0) stackprof (0.2.26) + stringio (3.1.2) temple (0.10.3) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - terser (1.2.2) + terser (1.2.4) execjs (>= 0.3.0, < 3) text (1.3.1) - thor (1.3.1) + thor (1.3.2) thread (0.2.2) thread_safe (0.3.6) thredded (1.1.0) @@ -628,36 +667,38 @@ GEM sassc-rails (>= 2.0.0) sprockets-es6 timeago_js (>= 3.0.2.2) - tilt (2.3.0) + tilt (2.4.0) timeago_js (3.0.2.2) - timeout (0.4.1) + timeout (0.4.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uglifier (4.2.0) - execjs (>= 0.3.0, < 3) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) uniform_notifier (1.16.0) - user_agent_parser (2.17.0) - vcr (6.2.0) + uri (1.0.2) + user_agent_parser (2.18.0) + useragent (0.16.10) + vcr (6.3.1) + base64 warden (1.2.9) rack (>= 2.0.9) - warning (1.3.0) + warning (1.4.0) wasabi (3.7.0) addressable httpi (~> 2.0) nokogiri (>= 1.4.2) - webmock (3.23.0) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - websocket (1.2.10) + webrick (1.9.0) + websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - will_paginate (4.0.0) + will_paginate (4.0.1) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.7.1) PLATFORMS ruby @@ -697,12 +738,13 @@ DEPENDENCIES flamegraph forty_facets friendly_id - gravatar_image_tag + gravatar_image_tag! + html-pipeline (~> 2.14) http_accept_language httparty i18n-tasks iiif-image-api! - iiif-presentation! + iiif-presentation importmap-rails interactor-rails (~> 2.0) iso-639 @@ -713,7 +755,9 @@ DEPENDENCIES memory_profiler meta_request mysql2 + net-pop! newrelic_rpm + nkf nokogiri oink omniauth (~> 1.9.2) @@ -729,11 +773,11 @@ DEPENDENCIES rack-attack rack-mini-profiler rack-reverse-proxy - rails (= 6.1.7.6) + rails (~> 7.2.1) rails-controller-testing - rails-i18n (~> 6.0.0) + rails-i18n (~> 7.0.0) recaptcha - riiif! + riiif rmagick rspec-rails rtl @@ -750,8 +794,7 @@ DEPENDENCIES stackprof terser text - thredded (~> 1.0) - uglifier + thredded (~> 1.1) user_agent_parser vcr warning @@ -759,7 +802,7 @@ DEPENDENCIES will_paginate RUBY VERSION - ruby 2.7.3p183 + ruby 3.3.5p100 BUNDLED WITH - 2.1.4 + 2.5.18 diff --git a/app/controllers/article_controller.rb b/app/controllers/article_controller.rb index c24c222294..11259dbf05 100644 --- a/app/controllers/article_controller.rb +++ b/app/controllers/article_controller.rb @@ -23,11 +23,11 @@ def list end def delete - result = Article::Destroy.call( + result = Article::Destroy.new( article: @article, user: current_user, collection: @collection - ) + ).call if result.success? redirect_to collection_subjects_path(@collection.owner, @collection) @@ -39,10 +39,10 @@ def delete def update if params[:save] - result = Article::Update.call( + result = Article::Update.new( article: @article, article_params: article_params - ) + ).call if result.success? record_deed @@ -75,10 +75,10 @@ def article_category end def combine_duplicate - Article::Combine.call( + Article::Combine.new( article: @article, from_article_ids: params[:from_article_ids] - ) + ).call flash[:notice] = t('.selected_subjects_combined', title: @article.title) redirect_to collection_article_edit_path(@collection.owner, @collection, @article) @@ -131,13 +131,17 @@ def show end end - dot_source = - render_to_string(:partial => "graph.dot", - :layout => false, - :locals => { :article_links => article_links, - :link_total => link_total, - :link_max => link_max, - :min_rank => min_rank }) + dot_source = render_to_string( + partial: 'graph', + layout: false, + locals: { + article_links: article_links, + link_total: link_total, + link_max: link_max, + min_rank: min_rank + }, + formats: [:dot] + ) dot_file = "#{Rails.root}/public/images/working/dot/#{@article.id}.dot" File.open(dot_file, "w") do |f| diff --git a/app/controllers/concerns/export_service.rb b/app/controllers/concerns/export_service.rb index e7633f2927..86b1f5793b 100644 --- a/app/controllers/concerns/export_service.rb +++ b/app/controllers/concerns/export_service.rb @@ -48,7 +48,7 @@ def export_printable(work, edition, format, preserve_lb, include_metadata, inclu # render to a string rendered_markdown = ApplicationController.new.render_to_string( - template: '/export/facing_edition.html', + template: '/export/facing_edition', layout: false, assigns: { collection: work.collection, @@ -58,7 +58,8 @@ def export_printable(work, edition, format, preserve_lb, include_metadata, inclu preserve_linebreaks: preserve_lb, include_metadata: include_metadata, include_contributors: include_contributors - } + }, + formats: [:html] ) # write the string to a temp directory @@ -129,7 +130,7 @@ def export_work_metadata_csv(out:, collection:) path = 'work_metadata.csv' out.put_next_entry(path) - result = Work::Metadata::ExportCsv.call(collection: collection, works: collection.works) + result = Work::Metadata::ExportCsv.new(collection: collection, works: collection.works).call out.write(result.csv_string) end diff --git a/app/controllers/deed_controller.rb b/app/controllers/deed_controller.rb index cda89fd48c..ab60c5b1df 100644 --- a/app/controllers/deed_controller.rb +++ b/app/controllers/deed_controller.rb @@ -32,12 +32,12 @@ def list # Scope for date if params[:start_date] - start_date = params[:start_date].to_datetime.to_s(:db) + start_date = params[:start_date].to_datetime.to_fs(:db) @deed = @deed.where("created_at >= ?", start_date) end - + if params[:end_date] - end_date = params[:end_date].to_datetime.to_s(:db) + end_date = params[:end_date].to_datetime.to_fs(:db) @deed = @deed.where("created_at <= ?", end_date) end diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index f52cf69fd7..9a026544a1 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -86,7 +86,7 @@ def subject_index_csv def work_metadata_csv filename = params[:filename] ? "#{params[:filename]}.csv" : "fromthepage_work_metadata_export_#{@collection.id}_#{Time.now.utc.iso8601}.csv" - result = Work::Metadata::ExportCsv.call(collection: @collection, works: @collection.works) + result = Work::Metadata::ExportCsv.new(collection: @collection, works: @collection.works).call send_data( result.csv_string, diff --git a/app/controllers/facets_controller.rb b/app/controllers/facets_controller.rb index 2298487cda..2f97fb45cf 100644 --- a/app/controllers/facets_controller.rb +++ b/app/controllers/facets_controller.rb @@ -54,11 +54,10 @@ def disable def update collection = Collection.find(params[:collection_id]) errors = [] - collection.metadata_coverages.each do |m| metadata = params[:metadata][m[:key]] unless metadata.nil? - if !metadata['order'].blank? + if metadata['order'].present? facet_label = metadata['label'].blank? ? m.key : metadata['label'] if m.facet_config.label.nil? label_hash = {} @@ -95,7 +94,10 @@ def update redirect_to collection_facets_path(collection.owner, collection), notice: t('collection.facets.collection_facets_updated_successfully') else - render('collection/facets', :locals => { :@metadata_coverages => collection.metadata_coverages, :@errors => errors }) + @metadata_coverages = collection.metadata_coverages + @errors = errors + + render 'collection/facets' end end diff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rb index b7914979a2..a8cfffde7a 100644 --- a/app/controllers/metadata_controller.rb +++ b/app/controllers/metadata_controller.rb @@ -4,7 +4,7 @@ class MetadataController < ApplicationController def example collection = Collection.find(params[:id]) works = collection.works.limit(3) - result = Work::Metadata::ExportCsv.call(collection: collection, works: works) + result = Work::Metadata::ExportCsv.new(collection: collection, works: works).call send_data result.csv_string, filename: 'example.csv' end diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 0c9bf4f57b..612e9e5143 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -28,7 +28,7 @@ def create if @note.save record_deed render json: { - html: render_to_string(partial: 'note.html', locals: { note: @note }, formats: [:html]), + html: render_to_string(partial: 'note', locals: { note: @note }, formats: [:html]), flash: render_to_string(partial: 'shared/flash', locals: { type: 'notice', message: t('.note_has_been_created') }, formats: [:html]) }, status: :created diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index 33ac8587a5..dc952838f8 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -1,6 +1,6 @@ module ExportHelper include XmlSourceProcessor - + def xml_to_pandoc_md(xml_text, preserve_lb=true, flatten_links=false, collection=nil, div_pad=true) # do some escaping of the document for markdown @@ -40,7 +40,7 @@ def xml_to_pandoc_md(xml_text, preserve_lb=true, flatten_links=false, collection postprocessed = doc.to_s # do the conversions for linebreaks, italics, etc. html = xml_to_html(postprocessed, preserve_lb, flatten_links, collection) - + if div_pad doc = REXML::Document.new("
#{html}
") else @@ -59,7 +59,7 @@ def xml_to_pandoc_md(xml_text, preserve_lb=true, flatten_links=false, collection processed = "never ran" cmd = "pandoc --from html --to markdown+pipe_tables" - Open3.popen2(cmd) do |stdin, stdout, t| + Open3.popen2(cmd) do |stdin, stdout, t| stdin.print(html) stdin.close processed = stdout.read @@ -198,7 +198,7 @@ def write_work_exports(works, out, export_user, bulk_export) format='expanded' export_plaintext_transcript_pages(name: format, out: out, page: page, by_work: by_work, original_filenames: original_filenames, index: nil) export_plaintext_translation_pages(name: format, out: out, page: page, by_work: by_work, original_filenames: original_filenames) - end + end if bulk_export.plaintext_searchable_page format='searchable' @@ -221,10 +221,9 @@ def write_work_exports(works, out, export_user, bulk_export) end end - def work_to_xhtml(work) - @work = Work.includes(pages: [{notes: :user}, {page_versions: :user}]).find_by(id: work.id) - render_to_string :layout => false, :template => "export/show.html.erb" + @work = Work.includes(pages: [{ notes: :user }, { page_versions: :user }]).find_by(id: work.id) + render_to_string template: 'export/show', layout: false, formats: [:html], handlers: [:erb] end def work_to_tei(work, exporting_user) @@ -288,8 +287,9 @@ def work_to_tei(work, exporting_user) end xml = thingy.render_to_string( - layout: false, - template: "export/tei.html.erb", + layout: false, + template: 'export/tei', + formats: [:html], assigns: { work: @work, context: @context, @@ -301,7 +301,8 @@ def work_to_tei(work, exporting_user) other_articles: @other_articles, collection: @work.collection, user: exporting_user - }) + } + ) post_process_xml(xml, @work) xml @@ -311,7 +312,7 @@ def work_to_tei(work, exporting_user) def page_id_to_xml_id(id, translation=false) return "" if id.blank? - + if translation "TTP#{id}" else @@ -327,11 +328,11 @@ def tei_taxonomy(categories, subjects) end tei << "\n" tei = REXML::Document.new(tei).to_s - + tei end - def category_to_tei(category, subjects, seen_subjects) + def category_to_tei(category, subjects, seen_subjects) has_content = false tei = "" tei << "\n" @@ -368,7 +369,7 @@ def expand_subject(subject) subjects end - + def subject_to_tei(subject) tei = format_subject_to_tei(subject) tei @@ -385,7 +386,7 @@ def format_subject_to_tei(subject) subject.categories.each do |category| tei << '' category.ancestors.reverse.each do |parent| - if parent.root? + if parent.root? category_class = "#category #root" else category_class = "#category #branch" @@ -419,7 +420,7 @@ def seen_subject_to_tei(subject, parent_category) tei << "\n" tei - + end def xml_to_export_tei(xml_text, context, page_id = "", add_corrsp=false) @@ -513,7 +514,7 @@ def transform_marginalia_and_catchwords(p_element) e.name='note' e.add_attribute('type', 'marginalia') end - + p_element.elements.each('//catchword') do |e| e.name='fw' e.add_attribute('type', 'catchword') @@ -524,7 +525,7 @@ def transform_tables(p_element) # convert HTML tables to TEI tables p_element_string = p_element.to_s p_element.elements.each("//table") do |e| - unless e['rows'] || e['cols'] + unless e['rows'] || e['cols'] row_count = 0 max_column_count = 0 table = REXML::Element.new("table") @@ -562,7 +563,7 @@ def transform_tables(p_element) table.add_attribute("cols", max_column_count) e.replace_with(table) end - + end # end of tables # now delete any lb elements from tables elements in the document p_element.elements.each("//table") do |table| @@ -570,13 +571,13 @@ def transform_tables(p_element) lb.remove end end - + end def transform_footnotes(p_element) p_element.elements.each('//footnote') do |e| marker = e.attributes['marker'] - + e.name='note' e.delete_attribute('marker') e.add_attribute('type', 'footnote') @@ -585,7 +586,7 @@ def transform_footnotes(p_element) end def transform_lb(p_element) - # while we support text within an LB tag to encode line + # while we support text within an LB tag to encode line # continuation sigla, TEI doesn't and recommends the sigil be part of the text before the LB p_element.elements.each('//lb') do |e| if e['break'] == 'no' @@ -597,7 +598,7 @@ def transform_lb(p_element) end end end - + end @@ -683,19 +684,19 @@ def post_process_xml(xml, work) else doc = REXML::Document.new(xml) doc_body = doc.get_elements('//body').first - + # Process Sections current_depth = 1 sections = [] - + doc_body.children.each do |e| - + if(e.node_type != :text && e.get_elements('head').length > 0) header = e.get_elements('head').first - + # Create the new section section = REXML::Element.new('section') - section.add_attribute('depth', header.attributes['depth']) + section.add_attribute('depth', header.attributes['depth']) # Handle where to put the new section if sections.empty? @@ -722,9 +723,9 @@ def post_process_xml(xml, work) # Adds the current element to the new section at the right location sections.first.add(e) unless sections.empty? - + end - + return doc end end @@ -779,7 +780,7 @@ def field_data_to_hash(page) end response_array = [] - page.table_cells.each do |cell| + page.table_cells.each do |cell| unless columns[cell.header] field = fields[cell.header] @@ -832,8 +833,8 @@ def field_data_to_hash(page) def spreadsheet_column_config(column, include_within) column_config = { - label: column.label, - input_type: column.input_type, + label: column.label, + input_type: column.input_type, position: column.position, profile: 'https://github.com/benwbrum/fromthepage/wiki/Structured-Data-API-for-Harvesting-Crowdsourced-Contributions#structured-data-spreadsheet-column-configuration-response' } @@ -851,9 +852,9 @@ def spreadsheet_column_config(column, include_within) def transcription_field_config(field, include_within) element = { - label: field.label, - input_type: field.input_type, - position: field.position, + label: field.label, + input_type: field.input_type, + position: field.position, line: field.line_number, profile: 'https://github.com/benwbrum/fromthepage/wiki/Structured-Data-API-for-Harvesting-Crowdsourced-Contributions#structured-data-field-configuration-response' } diff --git a/app/interactors/application_interactor.rb b/app/interactors/application_interactor.rb new file mode 100644 index 0000000000..cd972d90f2 --- /dev/null +++ b/app/interactors/application_interactor.rb @@ -0,0 +1,25 @@ +class ApplicationInteractor + + attr_reader :context + + def initialize(context = {}) + @context = Interactor::Context.build(context) + end + + def call + perform + + self + rescue Interactor::Failure + self + end + + def success? + context.success? + end + + def message + context.message + end + +end diff --git a/app/interactors/article/combine.rb b/app/interactors/article/combine.rb index 9a43f9e684..980cd251c6 100644 --- a/app/interactors/article/combine.rb +++ b/app/interactors/article/combine.rb @@ -1,5 +1,5 @@ -class Article::Combine - include Interactor +class Article::Combine < ApplicationInteractor + include Article::Lib::Common def initialize(article:, from_article_ids:) @@ -9,7 +9,7 @@ def initialize(article:, from_article_ids:) super end - def call + def perform return if @from_article_ids.blank? from_articles = Article.where(id: @from_article_ids) diff --git a/app/interactors/article/destroy.rb b/app/interactors/article/destroy.rb index 8ef7603e23..6b808ad932 100644 --- a/app/interactors/article/destroy.rb +++ b/app/interactors/article/destroy.rb @@ -1,5 +1,6 @@ -class Article::Destroy - include Interactor +class Article::Destroy < ApplicationInteractor + + attr_accessor :article def initialize(article:, user:, collection:) @article = article @@ -9,7 +10,7 @@ def initialize(article:, user:, collection:) super end - def call + def perform context.fail!(message: I18n.t('article.delete.must_remove_referring_links')) if article_has_referring_links context.fail!(message: I18n.t('article.delete.only_subject_owner_can_delete')) unless user_can_delete_article @@ -25,4 +26,5 @@ def article_has_referring_links def user_can_delete_article @article.created_by_id == @user.id || @user.like_owner?(@collection) end + end diff --git a/app/interactors/article/update.rb b/app/interactors/article/update.rb index 8f7770edd9..3e6bde8967 100644 --- a/app/interactors/article/update.rb +++ b/app/interactors/article/update.rb @@ -1,5 +1,7 @@ -class Article::Update - include Interactor +class Article::Update < ApplicationInteractor + + attr_accessor :article, :notice + include Article::Lib::Common def initialize(article:, article_params:) @@ -9,23 +11,19 @@ def initialize(article:, article_params:) super end - def call + def perform old_title = @article.title @article.attributes = @article_params if @article.save rename_article(@article, old_title, @article.title) if old_title != @article.title - notice = I18n.t('article.update.subject_successfully_updated') + @notice = I18n.t('article.update.subject_successfully_updated') if gis_truncated? - notice << I18n.t('article.update.gis_coordinates_truncated', precision: GIS_DECIMAL_PRECISION, + @notice << I18n.t('article.update.gis_coordinates_truncated', precision: GIS_DECIMAL_PRECISION, count: GIS_DECIMAL_PRECISION) end - - context.article = @article - context.notice = notice else - context.article = @article context.fail! end end @@ -43,4 +41,5 @@ def gis_truncated?(dec: GIS_DECIMAL_PRECISION) lat_dec > dec || lon_dec > dec end + end diff --git a/app/interactors/work/metadata/export_csv.rb b/app/interactors/work/metadata/export_csv.rb index 5319bb5dcd..b51c215599 100644 --- a/app/interactors/work/metadata/export_csv.rb +++ b/app/interactors/work/metadata/export_csv.rb @@ -1,6 +1,7 @@ require 'csv' -class Work::Metadata::ExportCsv +class Work::Metadata::ExportCsv < ApplicationInteractor + STATIC_HEADERS = [ 'FromThePage Title', '*Collection*', @@ -29,7 +30,8 @@ class Work::Metadata::ExportCsv '*Described By*' ].freeze - include Interactor + attr_accessor :csv_string + include Rails.application.routes.url_helpers def initialize(collection:, works:) @@ -39,8 +41,8 @@ def initialize(collection:, works:) super end - def call - csv_string = CSV.generate(force_quotes: true) do |csv| + def perform + @csv_string = CSV.generate(force_quotes: true) do |csv| works_scope = @works.includes( :document_sets, :work_statistic, @@ -119,8 +121,5 @@ def call csv << row end end - - context.csv_string = csv_string - context end end diff --git a/app/interactors/work/metadata/import_csv.rb b/app/interactors/work/metadata/import_csv.rb index 53c3f53578..f8f77850ec 100644 --- a/app/interactors/work/metadata/import_csv.rb +++ b/app/interactors/work/metadata/import_csv.rb @@ -1,6 +1,7 @@ require 'csv' -class Work::Metadata::ImportCsv +class Work::Metadata::ImportCsv < ApplicationInteractor + SPECIAL_HEADERS = [ # legacy headers 'work_id', @@ -15,19 +16,19 @@ class Work::Metadata::ImportCsv '*Uploaded Filename*' ].freeze - include Interactor + attr_accessor :content, :rowset_errors def initialize(metadata_file:, collection:) @metadata_file = metadata_file @collection = collection + @content = 0 @rowset_errors = [] super end - def call + def perform csv = read_csv(@metadata_file) - success = 0 csv.each do |row| metadata = [] @@ -72,14 +73,9 @@ def call work.original_metadata = metadata.to_json if metadata.present? work.save! - success += 1 + @content += 1 end end - - context.content = success - context.rowset_errors = @rowset_errors - - context end private @@ -111,4 +107,5 @@ def nil_work_row_error(work_id, work_title, work_filename) { error: I18n.t('metadata.import_csv.errors.not_existing_work', work_filename: work_filename) } end end + end diff --git a/app/interactors/work/metadata/refresh.rb b/app/interactors/work/metadata/refresh.rb index fc910f6eeb..f9d7c30c14 100644 --- a/app/interactors/work/metadata/refresh.rb +++ b/app/interactors/work/metadata/refresh.rb @@ -1,5 +1,6 @@ -class Work::Metadata::Refresh - include Interactor +class Work::Metadata::Refresh < ApplicationInteractor + + attr_reader :errors def initialize(work_ids: nil, batches: 100) @all_works = Work.where(id: work_ids) @@ -9,25 +10,17 @@ def initialize(work_ids: nil, batches: 100) super end - def call + def perform @all_works.in_batches(of: 100).each do |works| process_batches(works) end - - finalize rescue StandardError => e # :nocov: @errors << "Error: #{e}" - context.errors = @errors context.fail! # :nocov: end - def finalize - context.errors = @errors - context - end - private def process_batches(works) diff --git a/app/jobs/work/metadata/import_csv_job.rb b/app/jobs/work/metadata/import_csv_job.rb index c2ee1066a1..e938c0505d 100644 --- a/app/jobs/work/metadata/import_csv_job.rb +++ b/app/jobs/work/metadata/import_csv_job.rb @@ -6,10 +6,10 @@ def perform(metadata_file_path, collection_id, user_id) collection = Collection.find(collection_id) user = User.find(user_id) - result = Work::Metadata::ImportCsv.call( + result = Work::Metadata::ImportCsv.new( metadata_file: metadata_file, collection: collection - ) + ).call if SMTP_ENABLED begin diff --git a/app/models/ahoy/event.rb b/app/models/ahoy/event.rb index 8a5b323036..cd7da6a566 100644 --- a/app/models/ahoy/event.rb +++ b/app/models/ahoy/event.rb @@ -19,11 +19,11 @@ module Ahoy class Event < ActiveRecord::Base include Ahoy::Properties - self.table_name = "ahoy_events" + self.table_name = 'ahoy_events' belongs_to :visit, optional: true belongs_to :user, optional: true - serialize :properties, JSON + serialize :properties, coder: JSON end end diff --git a/app/models/collection_statistic.rb b/app/models/collection_statistic.rb index 2aa0806b22..fa6b2c00ff 100644 --- a/app/models/collection_statistic.rb +++ b/app/models/collection_statistic.rb @@ -95,11 +95,11 @@ def get_stats_hash(start_date=nil, end_date=nil) def timeframe(start_date, end_date, column='created_at') timeframe_clause = "" if start_date && end_date - timeframe_clause = "#{column} BETWEEN '#{start_date.to_s(:db)}' AND '#{end_date.to_s(:db)}'" + timeframe_clause = "#{column} BETWEEN '#{start_date.to_fs(:db)}' AND '#{end_date.to_fs(:db)}'" elsif start_date - timeframe_clause = "#{column} >= '#{start_date.to_s(:db)}'" + timeframe_clause = "#{column} >= '#{start_date.to_fs(:db)}'" elsif end_date - timeframe_clause = "#{column} <= '#{end_date.to_s(:db)}'" + timeframe_clause = "#{column} <= '#{end_date.to_fs(:db)}'" else end diff --git a/app/models/deed.rb b/app/models/deed.rb index ecbbe4886c..f428173741 100644 --- a/app/models/deed.rb +++ b/app/models/deed.rb @@ -42,7 +42,7 @@ class Deed < ApplicationRecord belongs_to :work, optional: true validates_inclusion_of :deed_type, in: DeedType.all_types - scope :order_by_recent_activity, -> { order('created_at DESC') } + scope :order_by_recent_activity, -> { order(created_at: :desc) } scope :active, -> { joins(:user).where(users: {deleted: false}) } scope :past_day, -> {where('created_at >= ?', 1.day.ago)} @@ -69,22 +69,43 @@ def calculate_prerender unless self.deed_type == DeedType::COLLECTION_INACTIVE || self.deed_type == DeedType::COLLECTION_ACTIVE renderer = ApplicationController.renderer.new locales = I18n.available_locales.reject { |locale| locale.to_s.include? "-" } # don't include regional locales - self.prerender = locales.to_h { |locale| - [ locale, - renderer.render(:partial => 'deed/deed.html', :locals => { :deed => self, :long_view => false, :prerender => true, locale: locale }) - ] - }.to_json + self.prerender = locales.to_h do |locale| + [ + locale, + renderer.render( + partial: 'deed/deed', + locals: { + deed: self, + long_view: false, + prerender: true, + locale: locale + }, + formats: [:html] + ) + ] + end.to_json end end def calculate_prerender_mailer renderer = ApplicationController.renderer.new locales = I18n.available_locales.reject { |locale| locale.to_s.include? "-" } # don't include regional locales - self.prerender_mailer = locales.to_h { |locale| - [ locale, - renderer.render(:partial => 'deed/deed.html', :locals => { :deed => self, :long_view => true, :prerender => true, :mailer => true, locale: locale }) + self.prerender_mailer = locales.to_h do |locale| + [ + locale, + renderer.render( + partial: 'deed/deed', + locals: { + deed: self, + long_view: true, + prerender: true, + mailer: true, + locale: locale + }, + formats: [:html] + ) ] - }.to_json + end.to_json end def update_collections_most_recent_deed diff --git a/app/models/document_set_statistic.rb b/app/models/document_set_statistic.rb index 121df3b230..5334bde4e8 100644 --- a/app/models/document_set_statistic.rb +++ b/app/models/document_set_statistic.rb @@ -93,11 +93,11 @@ def get_stats_hash(start_date=nil, end_date=nil) def timeframe(start_date, end_date, column='created_at') timeframe_clause = "" if start_date && end_date - timeframe_clause = "#{column} BETWEEN '#{start_date.to_s(:db)}' AND '#{end_date.to_s(:db)}'" + timeframe_clause = "#{column} BETWEEN '#{start_date.to_fs(:db)}' AND '#{end_date.to_fs(:db)}'" elsif start_date - timeframe_clause = "#{column} >= '#{start_date.to_s(:db)}'" + timeframe_clause = "#{column} >= '#{start_date.to_fs(:db)}'" elsif end_date - timeframe_clause = "#{column} <= '#{end_date.to_s(:db)}'" + timeframe_clause = "#{column} <= '#{end_date.to_fs(:db)}'" else end diff --git a/app/models/document_upload.rb b/app/models/document_upload.rb index 7f3ab07a6d..9a58422cbc 100644 --- a/app/models/document_upload.rb +++ b/app/models/document_upload.rb @@ -25,13 +25,13 @@ class DocumentUpload < ApplicationRecord mount_uploader :file, DocumentUploader - enum status: { + enum :status, { new: 'new', queued: 'queued', processing: 'processing', finished: 'finished', error: 'error' - }, _prefix: :status + }, prefix: :status def submit_process self.status = :queued diff --git a/app/models/ia_leaf.rb b/app/models/ia_leaf.rb index fa46a0f040..83fa7f474d 100644 --- a/app/models/ia_leaf.rb +++ b/app/models/ia_leaf.rb @@ -42,8 +42,8 @@ def iiif_image_info_url end def refresh_cache - unless File.exists?(cache_file_path) - unless Dir.exists?(cache_dir_path) + unless File.exist?(cache_file_path) + unless Dir.exist?(cache_dir_path) Dir.mkdir(cache_dir_path) end # import the image diff --git a/app/models/ia_work.rb b/app/models/ia_work.rb index c30957a8fc..89360c3374 100644 --- a/app/models/ia_work.rb +++ b/app/models/ia_work.rb @@ -165,7 +165,7 @@ def ingest_work(id) self.save! # now fetch the scandata.xml file and parse it - scandata_url = "http://#{server}#{dir}/#{URI.encode(scandata_file)}" # will not work on new format: we cannot assume filenames are re-named with their content + scandata_url = "http://#{server}#{dir}/#{CGI.escape(scandata_file)}" # will not work on new format: we cannot assume filenames are re-named with their content sd_doc = open_doc(scandata_url) @@ -279,7 +279,7 @@ def ocr_doc loc_doc = fetch_loc_doc(self.book_id) scandata_file, djvu_file = files_from_loc(loc_doc) - djvu_url = "http://#{self.server}#{self.ia_path}/#{URI.encode(djvu_file)}" + djvu_url = "http://#{self.server}#{self.ia_path}/#{CGI.escape(djvu_file)}" logger.debug(djvu_url) djvu_doc = open_doc(djvu_url) diff --git a/app/models/page.rb b/app/models/page.rb index d0d7b41524..91e2113682 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -87,7 +87,7 @@ class Page < ApplicationRecord # after_destroy :delete_deeds after_destroy :update_featured_page, if: Proc.new {|page| page.work.featured_page == page.id} - serialize :metadata, Hash + serialize :metadata, type: Hash STATUS_VALUES = { new: 'new', @@ -99,8 +99,8 @@ class Page < ApplicationRecord translated: 'translated' }.freeze - enum status: STATUS_VALUES, _prefix: :status - enum translation_status: STATUS_VALUES, _prefix: :translation_status + enum :status, STATUS_VALUES, prefix: :status + enum :translation_status, STATUS_VALUES, prefix: :translation_status scope :review, -> { where(status: :needs_review) } scope :incomplete, -> { where(status: :incomplete) } @@ -234,8 +234,8 @@ def thumbnail_image if self.base_image.blank? return nil end - if !File.exists?(thumbnail_filename()) - if File.exists?(modernize_absolute(self.base_image)) + if !File.exist?(thumbnail_filename()) + if File.exist?(modernize_absolute(self.base_image)) generate_thumbnail end end @@ -588,7 +588,7 @@ def contributors end def has_ai_plaintext? - File.exists?(ai_plaintext_path) + File.exist?(ai_plaintext_path) end def ai_plaintext @@ -604,12 +604,10 @@ def ai_plaintext=(text) File.write(ai_plaintext_path, text) end - def has_alto? - File.exists?(alto_path) + File.exist?(alto_path) end - def alto_xml if has_alto? File.read(alto_path) @@ -630,7 +628,8 @@ def image_url_for_download elsif self.ia_leaf self.ia_leaf.facsimile_url else - uri = URI.parse(URI.encode(file_to_url(self.canonical_facsimile_url))) + encoded_path = URI::DEFAULT_PARSER.escape(self.canonical_facsimile_url) + uri = URI.parse(encoded_path) # if we are in test, we will be http://localhost:3000 and need to separate out the port from the host raw_host = Rails.application.config.action_mailer.default_url_options[:host] host = raw_host.split(":")[0] diff --git a/app/views/admin/expunge_confirmation.html.slim b/app/views/admin/expunge_confirmation.html.slim index 133b3b38b8..e5b56921c1 100644 --- a/app/views/admin/expunge_confirmation.html.slim +++ b/app/views/admin/expunge_confirmation.html.slim @@ -7,7 +7,7 @@ =hidden_field_tag :flag_id, params[:flag_id] .toolbar - .toolbar_group.aright + .toolbar_group.aright =f.button t('.expunge_user_display_name', user: @user.display_name), class: 'big', tabindex: '1', autofocus: true h2 =t('.user_contributions_to_be_deleted') @@ -15,7 +15,7 @@ -@user.deeds.each do |d| tr td.w100.toleft - =render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true }) + =render(partial: 'deed/deed', locals: { deed: d, long_view: true }, formats: [:html]) td small.label(class="deed-type-#{d.deed_type}") =t(d.deed_type_name) td.nowrap diff --git a/app/views/admin/visit_deeds.html.slim b/app/views/admin/visit_deeds.html.slim index aae265c49a..a7449940f7 100644 --- a/app/views/admin/visit_deeds.html.slim +++ b/app/views/admin/visit_deeds.html.slim @@ -9,7 +9,7 @@ table.datagrid.striped =link_to(user_profile_path(d.user), class: 'userpic userpic-small') =profile_picture(d.user) td.w100.toleft - =render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true }) + =render(partial: 'deed/deed', locals: { deed: d, long_view: true }, formats: [:html]) td small.label(class="deed-type-#{d.deed_type}") =t(d.deed_type_name) td.nowrap diff --git a/app/views/admin_mailer/collection_stats_by_owner.html.slim b/app/views/admin_mailer/collection_stats_by_owner.html.slim index a489a6b82f..c804bd4fdb 100644 --- a/app/views/admin_mailer/collection_stats_by_owner.html.slim +++ b/app/views/admin_mailer/collection_stats_by_owner.html.slim @@ -6,7 +6,7 @@ h2.nomargin =t('.recent_activity') h3 =t('.you_have_new_collaborators') - @activity.collaborators.each do |user| a href="mailto:#{user.email}" "#{user.email} #{user.login}"
- p + p =t('.you_may_consider', link: link_to("How to write a welcome email", "https://content.fromthepage.com/project-owner-documentation/new-collaborator-email/")).html_safe / New Notes and Comments @@ -17,7 +17,7 @@ h2.nomargin =t('.recent_activity') -if comment.prerender_mailer =raw(show_prerender(comment.prerender_mailer, I18n.locale)) -else - =render(:partial => 'deed/deed.html', :locals => { :deed => comment, :long_view => true, :mailer => true }) + =render(partial: 'deed/deed', locals: { deed: comment, long_view: true, mailer: true }, formats: [:html]) |
/ Raw Activity stream (without notes) @@ -25,17 +25,17 @@ h2.nomargin =t('.recent_activity') h3 =t('.other_recent_activity') - @activity.activity.each do |collection_title,deeds| h4 #{collection_title} - p + p - deeds.each do |deed| -if deed.prerender =raw(show_prerender(deed.prerender_mailer, I18n.locale)) -else - =render(:partial => 'deed/deed.html', :locals => { :deed => deed, :long_view => true, :mailer => true }) + =render(partial: 'deed/deed', locals: { deed: comment, long_view: true, mailer: true }, formats: [:html]) |
- + h3 =t('.how_is_your_project_going') -p +p i =t('.what_is_easy').html_safe p - =t('.opt_out_email', link: link_to("here", update_profile_url(@activity.owner, only_path: false))).html_safe \ No newline at end of file + =t('.opt_out_email', link: link_to("here", update_profile_url(@activity.owner, only_path: false))).html_safe diff --git a/app/views/dashboard/guest.html.slim b/app/views/dashboard/guest.html.slim index 25be779f08..4ae3fb6747 100644 --- a/app/views/dashboard/guest.html.slim +++ b/app/views/dashboard/guest.html.slim @@ -7,7 +7,7 @@ -snippet = to_snippet(c.intro_block) -unless snippet.empty? p.collection_snippet =snippet - br + br -c.deeds.includes(:user, :page, :work).limit(5).each do |d| //- Hide collection link -d.collection = nil @@ -17,4 +17,4 @@ .user-bubble_content =time_tag d.created_at =time_ago_in_words d.created_at - p =render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true }) + p =render(partial: 'deed/deed', locals: { deed: d, long_view: true }, formats: [:html]) diff --git a/app/views/dashboard/watchlist.html.slim b/app/views/dashboard/watchlist.html.slim index a74572d189..a6946094c7 100644 --- a/app/views/dashboard/watchlist.html.slim +++ b/app/views/dashboard/watchlist.html.slim @@ -23,7 +23,7 @@ h1 =t('dashboard.collaborator') =profile_picture(d.user) .user-bubble_content =timeago d.created_at - p =render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true }) + p =render(partial: 'deed/deed', locals: { deed: d, long_view: true }, formats: [:html]) -else =t('.try_transcribing_a_page') =link_to t('.collections'), dashboard_path @@ -41,4 +41,4 @@ h1 =t('dashboard.collaborator') $(document).ready(function() { $("time.timeago").timeago("setLocale", '#{I18n.locale}'); $("time.timeago").timeago(); - }); \ No newline at end of file + }); diff --git a/app/views/deed/_deeds.html.slim b/app/views/deed/_deeds.html.slim index 94dd2b4d68..94304c3d21 100644 --- a/app/views/deed/_deeds.html.slim +++ b/app/views/deed/_deeds.html.slim @@ -8,7 +8,7 @@ -if d.prerender ==show_prerender(d.prerender, I18n.locale) -else - =render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => long_view, :suppress_collection => suppress_collection }) + =render(partial: 'deed/deed', locals: { deed: d, long_view: long_view, suppress_collection: suppress_collection }, formats: [:html]) -if !@collection.nil? && (@collection.most_recent_deed_created_at && @collection.most_recent_deed_created_at > (Time.now - 1.year)) small.legend diff --git a/app/views/deed/list.html.slim b/app/views/deed/list.html.slim index 88d358188c..daf2ec4942 100644 --- a/app/views/deed/list.html.slim +++ b/app/views/deed/list.html.slim @@ -15,7 +15,7 @@ h1 =t('.activity_stream') h3 =t('.user_title', title: @user.display_name) table.datagrid.striped#deeds-list - thead + thead th th= t('.deed') th= t('.type') @@ -29,12 +29,12 @@ table.datagrid.striped#deeds-list td.w100.toleft -if @collection.nil? -if d.collection.show_to?(current_user) || (d.work && d.work.access_object(current_user)) - =render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true }) + =render(partial: 'deed/deed', locals: { deed: d, long_view: true }, formats: [:html]) -else - =raw(strip_tags(render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true }))) + =raw(strip_tags(render(partial: 'deed/deed', locals: { deed: d, long_view: true }, formats: [:html]))) -else - =render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true, :suppress_collection => true }) - + =render(partial: 'deed/deed', locals: { deed: d, long_view: true, suppress_collection: true }, formats: [:html]) + td small.label(class="deed-type-#{d.deed_type}") =t(d.deed_type_name) td.nowrap (data-order="#{d.created_at.to_i}") diff --git a/app/views/user/_user_profile.html.slim b/app/views/user/_user_profile.html.slim index 1ee8a8cc2c..71fb8f250b 100644 --- a/app/views/user/_user_profile.html.slim +++ b/app/views/user/_user_profile.html.slim @@ -32,9 +32,9 @@ table.datagrid.striped tr td.w100.toleft -if d.work.nil? || d.work.access_object(current_user) - =render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true }) + =render(partial: 'deed/deed', locals: { deed: d, long_view: true }, formats: [:html]) -else - =raw(strip_tags(render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true }))) + =raw(strip_tags(render(partial: 'deed/deed', locals: { deed: d, long_view: true }, formats: [:html]))) td small.label(class="deed-type-#{d.deed_type}") =t(d.deed_type_name) diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index e5a246d3b2..e6b62aa5de 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -106,16 +106,34 @@ ignore_missing: - 'deed.deed.*' - 'article.graph.title' - 'thredded.*' - es: &NOT_EN + es: + - '{!, !0, next, throw}' + - 'deed.deed.*' + - 'article.graph.title' + - 'admin.*' + - 'admin_mailer.*' + - 'thredded.*' + pt: + - '{!, !0, next, throw}' + - 'deed.deed.*' + - 'article.graph.title' + - 'admin.*' + - 'admin_mailer.*' + - 'thredded.*' + fr: + - '{!, !0, next, throw}' + - 'deed.deed.*' + - 'article.graph.title' + - 'admin.*' + - 'admin_mailer.*' + - 'thredded.*' + de: - '{!, !0, next, throw}' - 'deed.deed.*' - 'article.graph.title' - 'admin.*' - 'admin_mailer.*' - 'thredded.*' - pt: *NOT_EN - fr: *NOT_EN - de: *NOT_EN ## Consider these keys used: ignore_unused: diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index dc1899682b..74cc7a2f11 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -2,3 +2,6 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf + +Mime::Type.register 'text/vnd.graphviz', :dot +ActionView::Template.register_template_handler :erb, ActionView::Template::Handlers::ERB.new diff --git a/config/initializers/thredded.rb b/config/initializers/thredded.rb index 9ac6271a07..c2fa9268bf 100644 --- a/config/initializers/thredded.rb +++ b/config/initializers/thredded.rb @@ -202,4 +202,4 @@ # This is render in the Thredded view context, so all Thredded helpers and URLs are accessible here directly. render 'shared/collection_tabs', form: form end -end \ No newline at end of file +end diff --git a/config/locales/article/article-de.yml b/config/locales/article/article-de.yml index 47856e70f5..23c0265c18 100644 --- a/config/locales/article/article-de.yml +++ b/config/locales/article/article-de.yml @@ -38,8 +38,7 @@ de: title: Titel uri: URI graph: - dot: - title: Häufig in Verbindung mit %{subject} genannte Entitäten + title: Häufig in Verbindung mit %{subject} genannte Entitäten list: actions: Aktionen add_child_category: Untergeordnete Kategorie hinzufügen diff --git a/config/locales/article/article-en.yml b/config/locales/article/article-en.yml index efdf59f22d..b45a33a4a4 100644 --- a/config/locales/article/article-en.yml +++ b/config/locales/article/article-en.yml @@ -38,8 +38,7 @@ en: title: Title uri: URI graph: - dot: - title: Subjects Mentioned Frequently With %{subject} + title: Subjects Mentioned Frequently With %{subject} list: actions: Actions add_child_category: Add Child Category diff --git a/config/locales/article/article-es.yml b/config/locales/article/article-es.yml index 69dbe1494b..25f649a87a 100644 --- a/config/locales/article/article-es.yml +++ b/config/locales/article/article-es.yml @@ -38,8 +38,7 @@ es: title: Título uri: URI graph: - dot: - title: Temas mencionados frecuentemente con %{subject} + title: Temas mencionados frecuentemente con %{subject} list: actions: Comportamiento add_child_category: Agregar categoría secundaria diff --git a/config/locales/article/article-fr.yml b/config/locales/article/article-fr.yml index 104d225924..e253158b6b 100644 --- a/config/locales/article/article-fr.yml +++ b/config/locales/article/article-fr.yml @@ -38,8 +38,7 @@ fr: title: Titre uri: URI graph: - dot: - title: Sujets fréquemment mentionnés avec %{subject} + title: Sujets fréquemment mentionnés avec %{subject} list: actions: Actions add_child_category: Ajouter une sous-catégorie diff --git a/config/locales/article/article-pt.yml b/config/locales/article/article-pt.yml index 43fb2cf9ef..4366e6af23 100644 --- a/config/locales/article/article-pt.yml +++ b/config/locales/article/article-pt.yml @@ -38,8 +38,7 @@ pt: title: Título uri: URI graph: - dot: - title: Assuntos mencionados frequentemente com %{subject} + title: Assuntos mencionados frequentemente com %{subject} list: actions: Ações add_child_category: Adicionar categoria secundária diff --git a/config/locales/deed/deed-en.yml b/config/locales/deed/deed-en.yml index 446158fbf8..625ff2da70 100644 --- a/config/locales/deed/deed-en.yml +++ b/config/locales/deed/deed-en.yml @@ -6,29 +6,28 @@ en: collection_inactive: Collection Inactive collection_joined: Collection Joined deed: - html: - added_a_note_to_page: added a note to %{page} - added_work: added %{work} - corrected_page: corrected %{page} - described_metadata: described metadata - edited_article: edited %{article} - edited_metadata: edited metadata - edited_page: edited %{page} - edited_translation_of_page: edited the translation of %{page} - in_collection: " in %{collection}" - in_the_work: " in %{work}" - indexed_page: indexed %{page} - indexed_translation_of_page: indexed the translation of %{page} - joined: 'joined ' - marked_page_as_blank: marked %{page} as blank - marked_page_as_needing_review: marked %{page} as needing review - marked_translation_page_as_needing_review: marked translation %{page} as needing review - reviewed_page: 'reviewed %{page} ' - reviewed_translation: reviewed translation of %{page} - saying_deed: ", saying “%{title}”" - this_collection: this collection - transcribed_page: transcribed %{page} - translated_page: translated %{page} + added_a_note_to_page: added a note to %{page} + added_work: added %{work} + corrected_page: corrected %{page} + described_metadata: described metadata + edited_article: edited %{article} + edited_metadata: edited metadata + edited_page: edited %{page} + edited_translation_of_page: edited the translation of %{page} + in_collection: " in %{collection}" + in_the_work: " in %{work}" + indexed_page: indexed %{page} + indexed_translation_of_page: indexed the translation of %{page} + joined: 'joined ' + marked_page_as_blank: marked %{page} as blank + marked_page_as_needing_review: marked %{page} as needing review + marked_translation_page_as_needing_review: marked translation %{page} as needing review + reviewed_page: 'reviewed %{page} ' + reviewed_translation: reviewed translation of %{page} + saying_deed: ", saying “%{title}”" + this_collection: this collection + transcribed_page: transcribed %{page} + translated_page: translated %{page} deeds: show_more: Show More described_metadata: Described Metadata diff --git a/config/locales/deed/deed-es.yml b/config/locales/deed/deed-es.yml index ae1cbe828c..ae1e2168e4 100644 --- a/config/locales/deed/deed-es.yml +++ b/config/locales/deed/deed-es.yml @@ -6,27 +6,26 @@ es: collection_inactive: Colección inactiva collection_joined: Colección Unida deed: - html: - added_a_note_to_page: añadió una nota a la página %{page} - added_work: "%{work} añadido" - corrected_page: página corregida %{page} - edited_article: editó el %{article} artículo - edited_page: editó la página %{page} - edited_translation_of_page: editó la traducción de la página %{page} - in_collection: " en la colección %{collection}" - in_the_work: " en la obra %{work}" - indexed_page: indexó la página %{page} - indexed_translation_of_page: indexó la traducción de la página %{page} - joined: 'se unió ' - marked_page_as_blank: marcó la página %{page} como en blanco - marked_page_as_needing_review: marcó %{page} la página como en necesidad de revisión - marked_translation_page_as_needing_review: marcó la página de traducción %{page} como necesitando revisión - reviewed_page: revisada %{page} - reviewed_translation: traducción revisada de la página %{page} - saying_deed: ", diciendo “%{title}”" - this_collection: esta colección - transcribed_page: transcribió la página %{page} - translated_page: tradujo la página %{page} + added_a_note_to_page: añadió una nota a la página %{page} + added_work: "%{work} añadido" + corrected_page: página corregida %{page} + edited_article: editó el %{article} artículo + edited_page: editó la página %{page} + edited_translation_of_page: editó la traducción de la página %{page} + in_collection: " en la colección %{collection}" + in_the_work: " en la obra %{work}" + indexed_page: indexó la página %{page} + indexed_translation_of_page: indexó la traducción de la página %{page} + joined: 'se unió ' + marked_page_as_blank: marcó la página %{page} como en blanco + marked_page_as_needing_review: marcó %{page} la página como en necesidad de revisión + marked_translation_page_as_needing_review: marcó la página de traducción %{page} como necesitando revisión + reviewed_page: revisada %{page} + reviewed_translation: traducción revisada de la página %{page} + saying_deed: ", diciendo “%{title}”" + this_collection: esta colección + transcribed_page: transcribió la página %{page} + translated_page: tradujo la página %{page} deeds: show_more: Mostrar Más described_metadata: Metadatos descritos diff --git a/config/locales/deed/deed-fr.yml b/config/locales/deed/deed-fr.yml index f1e3eb9bee..d3cb935819 100644 --- a/config/locales/deed/deed-fr.yml +++ b/config/locales/deed/deed-fr.yml @@ -6,29 +6,28 @@ fr: collection_inactive: Collecte inactive collection_joined: Collection rejointe deed: - html: - added_a_note_to_page: a ajouté une note à la page %{page} - added_work: a ajouté %{work} - corrected_page: a corrigé %{page} - described_metadata: métadonnées décrites - edited_article: a modifié %{article} - edited_metadata: métadonnées modifiées - edited_page: a modifié %{page} - edited_translation_of_page: a édité la traduction de %{page} - in_collection: " dans la collection %{collection}" - in_the_work: " dans l'œuvre %{work}" - indexed_page: a indexée %{page} - indexed_translation_of_page: a indexé la traduction de %{page} - joined: 'a rejoint ' - marked_page_as_blank: a marqué la page %{page} comme vierge - marked_page_as_needing_review: a marqué la page %{page} comme nécessitant une révision - marked_translation_page_as_needing_review: a marqué la page à traduire %{page} comme nécessitant une révision - reviewed_page: a révisé %{page} - reviewed_translation: a révisé la traduction %{page} - saying_deed: ", disant «%{title}»" - this_collection: cette collection - transcribed_page: a transcrit %{page} - translated_page: a traduit %{page} + added_a_note_to_page: a ajouté une note à la page %{page} + added_work: a ajouté %{work} + corrected_page: a corrigé %{page} + described_metadata: métadonnées décrites + edited_article: a modifié %{article} + edited_metadata: métadonnées modifiées + edited_page: a modifié %{page} + edited_translation_of_page: a édité la traduction de %{page} + in_collection: " dans la collection %{collection}" + in_the_work: " dans l'œuvre %{work}" + indexed_page: a indexée %{page} + indexed_translation_of_page: a indexé la traduction de %{page} + joined: 'a rejoint ' + marked_page_as_blank: a marqué la page %{page} comme vierge + marked_page_as_needing_review: a marqué la page %{page} comme nécessitant une révision + marked_translation_page_as_needing_review: a marqué la page à traduire %{page} comme nécessitant une révision + reviewed_page: a révisé %{page} + reviewed_translation: a révisé la traduction %{page} + saying_deed: ", disant «%{title}»" + this_collection: cette collection + transcribed_page: a transcrit %{page} + translated_page: a traduit %{page} deeds: show_more: Voir plus described_metadata: Métadonnées décrites diff --git a/config/locales/deed/deed-pt.yml b/config/locales/deed/deed-pt.yml index d1b08097f7..e26d502c83 100644 --- a/config/locales/deed/deed-pt.yml +++ b/config/locales/deed/deed-pt.yml @@ -6,27 +6,26 @@ pt: collection_inactive: Coleção inativa collection_joined: Coleção associada deed: - html: - added_a_note_to_page: adicionou uma nota à página %{page} - added_work: adicionou %{work} - corrected_page: corrigiu a página %{page} - edited_article: editou o %{article} artigo - edited_page: editou a página %{page} - edited_translation_of_page: editou a tradução da página %{page} - in_collection: " na %{collection} coleção" - in_the_work: " na obra %{work}" - indexed_page: indexou a página %{page} - indexed_translation_of_page: indexou a tradução da página %{page} - joined: 'se juntou ' - marked_page_as_blank: marcou a página %{page} como em branco - marked_page_as_needing_review: marcou a página %{page} como precisando de revisão - marked_translation_page_as_needing_review: marcou a página de tradução %{page} como precisando de revisão - reviewed_page: 'página revisada %{page} ' - reviewed_translation: tradução revisada da página %{page} - saying_deed: ", dizendo “%{title}”" - transcribed_page: transcreveu a página %{page} - translated_page: traduziu a página %{page} + added_a_note_to_page: adicionou uma nota à página %{page} + added_work: adicionou %{work} + corrected_page: corrigiu a página %{page} + edited_article: editou o %{article} artigo + edited_page: editou a página %{page} + edited_translation_of_page: editou a tradução da página %{page} + in_collection: " na %{collection} coleção" + in_the_work: " na obra %{work}" + indexed_page: indexou a página %{page} + indexed_translation_of_page: indexou a tradução da página %{page} + joined: 'se juntou ' + marked_page_as_blank: marcou a página %{page} como em branco + marked_page_as_needing_review: marcou a página %{page} como precisando de revisão + marked_translation_page_as_needing_review: marcou a página de tradução %{page} como precisando de revisão + reviewed_page: 'página revisada %{page} ' + reviewed_translation: tradução revisada da página %{page} + saying_deed: ", dizendo “%{title}”" this_collection: esta coleção + transcribed_page: transcreveu a página %{page} + translated_page: traduziu a página %{page} deeds: show_more: Mostrar Mais described_metadata: Metadados Descritos diff --git a/config/locales/notes/notes-de.yml b/config/locales/notes/notes-de.yml index 62f77e1472..6eda33de1d 100644 --- a/config/locales/notes/notes-de.yml +++ b/config/locales/notes/notes-de.yml @@ -21,13 +21,6 @@ de: confirm_delete_message: Möchten Sie diese Anmerkung wirklich löschen? delete: Löschen edit: Bearbeiten - html: - cancel: Abbrechen - confirm_delete_message: Möchten Sie diese Anmerkung wirklich löschen? - delete: Löschen - edit: Bearbeiten - microphone: Mikrofon - update: Aktualisieren microphone: Mikrofon update: Aktualisieren notes: diff --git a/config/locales/notes/notes-en.yml b/config/locales/notes/notes-en.yml index d6fde270a1..6931f267a8 100644 --- a/config/locales/notes/notes-en.yml +++ b/config/locales/notes/notes-en.yml @@ -21,13 +21,6 @@ en: confirm_delete_message: Are you sure you want to delete this note? delete: Delete edit: Edit - html: - cancel: Cancel - confirm_delete_message: Are you sure you want to delete this note? - delete: Delete - edit: Edit - microphone: Microphone - update: Update microphone: Microphone update: Update notes: diff --git a/config/locales/notes/notes-es.yml b/config/locales/notes/notes-es.yml index da326b1515..66304242f0 100644 --- a/config/locales/notes/notes-es.yml +++ b/config/locales/notes/notes-es.yml @@ -21,13 +21,6 @@ es: confirm_delete_message: Confirma que deseas eliminar esta nota. delete: Eliminar edit: Editar - html: - cancel: Cancelar - confirm_delete_message: Confirma que deseas eliminar esta nota. - delete: Eliminar - edit: Editar - microphone: Micrófono - update: Actualizar microphone: Micrófono update: Actualizar notes: diff --git a/config/locales/notes/notes-fr.yml b/config/locales/notes/notes-fr.yml index d63af2de73..e94726c575 100644 --- a/config/locales/notes/notes-fr.yml +++ b/config/locales/notes/notes-fr.yml @@ -21,13 +21,6 @@ fr: confirm_delete_message: Voulez-vous vraiment supprimer cette note ? delete: Effacer edit: Éditer - html: - cancel: Annuler - confirm_delete_message: Voulez-vous vraiment supprimer cette note ? - delete: Effacer - edit: Éditer - microphone: Microphone - update: Mise à jour microphone: Microphone update: Mise à jour notes: diff --git a/config/locales/notes/notes-pt.yml b/config/locales/notes/notes-pt.yml index 4826eeba05..bf50f04afd 100644 --- a/config/locales/notes/notes-pt.yml +++ b/config/locales/notes/notes-pt.yml @@ -21,13 +21,6 @@ pt: confirm_delete_message: Você tem certeza que deseja apagar esta nota? delete: Apagar edit: Editar - html: - cancel: Cancelar - confirm_delete_message: Você tem certeza que deseja apagar esta nota? - delete: Apagar - edit: Editar - microphone: Microfone - update: Atualizar microphone: Microfone update: Atualizar notes: diff --git a/db/migrate/006_create_pages.rb b/db/migrate/006_create_pages.rb index 471f9b303c..c268c87fa1 100644 --- a/db/migrate/006_create_pages.rb +++ b/db/migrate/006_create_pages.rb @@ -20,6 +20,10 @@ def self.up t.column :created_on, :datetime t.column :position, :integer t.column :lock_version, :integer, :default => 0 + + # enum backsupport + t.column :status, :string, default: :new + t.column :translation_status, :string, default: :new end end diff --git a/db/migrate/20110225022301_pages_have_status.rb b/db/migrate/20110225022301_pages_have_status.rb index a53b143198..49bf245760 100644 --- a/db/migrate/20110225022301_pages_have_status.rb +++ b/db/migrate/20110225022301_pages_have_status.rb @@ -1,6 +1,6 @@ class PagesHaveStatus < ActiveRecord::Migration[5.0] def self.up - unless Page.columns_hash['status'] + unless column_exists?(:pages, :status) add_column :pages, :status, :string, :length => 10 end diff --git a/db/migrate/20170215134719_add_status_information.rb b/db/migrate/20170215134719_add_status_information.rb index aaecb731d1..3cae1eac62 100644 --- a/db/migrate/20170215134719_add_status_information.rb +++ b/db/migrate/20170215134719_add_status_information.rb @@ -4,7 +4,9 @@ def change add_column :work_statistics, :needs_review, :integer #add translation status to pages - add_column :pages, :translation_status, :string + unless column_exists?(:pages, :translation_status) + add_column :pages, :translation_status, :string + end #add translation columns to work statistics add_column :work_statistics, :translated_pages, :integer diff --git a/lib/image_helper.rb b/lib/image_helper.rb index 25190e7846..c989dca46c 100644 --- a/lib/image_helper.rb +++ b/lib/image_helper.rb @@ -5,32 +5,32 @@ include Magick module ImageHelper - + ############################# # Code for new zoom feature ############################# def self.unzip_file (file, destination) print "upzip_file(#{file})\n" - + Zip::File.open(file) do |zip_file| zip_file.each do |f| # f_path=File.join(destination, File.basename(f.name)) # FileUtils.mkdir_p(File.dirname(destination)) unless Dir.exist? destination outfile = File.join(destination, f.name) FileUtils.mkdir_p(File.dirname(outfile)) - + print "\textracting #{outfile}\n" zip_file.extract(f, outfile) end end - + end - + def self.extract_pdf(filename, ocr=false) pattern = Regexp.new(File.extname(filename) + "$") destination = filename.gsub(pattern, '') - FileUtils.mkdir(destination) unless File.exists?(destination) + FileUtils.mkdir(destination) unless File.exist?(destination) pattern = File.join(destination, "page_%04d.jpg") gs = "gs -r300x300 -dJPEGQ=30 -o '#{pattern}' -sDEVICE=jpeg '#{filename}'" print "\t\t#{gs}\n" @@ -47,7 +47,7 @@ def self.extract_pdf(filename, ocr=false) system(pdftotext) end end - + destination end @@ -61,8 +61,8 @@ def self.compress_file(filename) compress_image(filename) end end - - + + MAX_FILE_SIZE = 2000000 def self.compress_files_in_dir(dirname) @@ -89,7 +89,7 @@ def self.compress_image(filename) File.unlink(filename) FileUtils.cp(working_file, filename) File.unlink(working_file) - end + end end def self.convert_tiff(filename) diff --git a/spec/features/archive_import_spec.rb b/spec/features/archive_import_spec.rb index 2be53ff884..35961c648e 100644 --- a/spec/features/archive_import_spec.rb +++ b/spec/features/archive_import_spec.rb @@ -21,6 +21,7 @@ page.find('.tabs').click_link('Start A Project') page.find(:css, '#import-internet-archive').click click_link('Import From Archive.org') + expect(page).to have_selector('#detail_url', visible: true) fill_in 'detail_url', with: ia_link click_button('Import Work') click_button('Import Anyway') if page.has_button?('Import Anyway') diff --git a/spec/features/collection_metadata_spec.rb b/spec/features/collection_metadata_spec.rb index 5de62972a6..ad037e66e4 100644 --- a/spec/features/collection_metadata_spec.rb +++ b/spec/features/collection_metadata_spec.rb @@ -57,9 +57,9 @@ end end - it "increments occurrences as works are re-imported", :js => true do + it "increments occurrences as works are re-imported", js: true do login_as @owner - c = Collection.where(title: "ladi").first + c = Collection.find_by(title: 'ladi') filename = c.metadata_coverages.where(key: 'filename').first expect(filename.count).to eq 3 diff --git a/spec/features/collection_spec.rb b/spec/features/collection_spec.rb index d260159dd9..89e86e515a 100644 --- a/spec/features/collection_spec.rb +++ b/spec/features/collection_spec.rb @@ -1,4 +1,3 @@ - require 'spec_helper' describe "collection settings js tasks", :order => :defined do @@ -292,38 +291,40 @@ @factory_owner = create(:owner) end - it 'updates collection statistics', :js => true do - login_as(@factory_owner, :scope => :user) - visit dashboard_owner_path(@factory_owner) - expect(page).to have_content('Start A Project') - page.find('.tabs').click_link('Start A Project') - - page.find(:css, '#create-empty-work').click - - select('Add New Collection', :from => 'work_collection_id') - page.find('#new_collection').fill_in('collection_title', with: 'Stats Test Collection') - old_count = Collection.all.count - click_button('Create Collection') - sleep 3 - expect(Collection.all.to_a.count).to eq(old_count+1) - - page.find(:css, '#create-empty-work').click - sleep 3 - fill_in('work_title', with: 'Stats Test Work') - click_button('Create Work') - page.find('#new_page') - click_button('Save & New Work') - - visit dashboard_owner_path - - page.find('.collections').click_link('Stats Test Collection') - page.find('.collection-works .collection-work_title').click_link('Stats Test Work') - page.find('.maincol h4').click_link('Page 1') - fill_in_editor_field('Transcription') - page.find('#finish_button_top').click - - page.find('.breadcrumbs').click_link('Stats Test Collection') - expect(page).to have_content("All works are fully transcribed.") + it 'updates collection statistics', js: true do + login_as(@factory_owner, scope: :user) + + visit dashboard_owner_path(@factory_owner) + expect(page).to have_content('Start A Project') + page.find('.tabs').click_link('Start A Project') + + page.find(:css, '#create-empty-work').click + + select('Add New Collection', from: 'work_collection_id') + expect(page).to have_selector('#new_collection', visible: true) + page.fill_in('collection_title', with: 'Stats Test Collection') + old_count = Collection.all.count + click_button('Create Collection') + sleep 3 + expect(Collection.all.to_a.count).to eq(old_count+1) + + page.find(:css, '#create-empty-work').click + sleep 3 + fill_in('work_title', with: 'Stats Test Work') + click_button('Create Work') + page.find('#new_page') + click_button('Save & New Work') + + visit dashboard_owner_path + + page.find('.collections').click_link('Stats Test Collection') + page.find('.collection-works .collection-work_title').click_link('Stats Test Work') + page.find('.maincol h4').click_link('Page 1') + fill_in_editor_field('Transcription') + page.find('#finish_button_top').click + + page.find('.breadcrumbs').click_link('Stats Test Collection') + expect(page).to have_content("All works are fully transcribed.") end context 'Collection Settings' do @@ -391,7 +392,7 @@ after :all do @factory_owner.collections.each do |c| - c.destroy + c.destroy end @factory_owner.destroy end diff --git a/spec/features/document_sets_spec.rb b/spec/features/document_sets_spec.rb index 4ed0650b65..53bb3a6c47 100644 --- a/spec/features/document_sets_spec.rb +++ b/spec/features/document_sets_spec.rb @@ -265,8 +265,9 @@ expect(page.find('h1')).to have_content(@set.title) end - it "checks document set breadcrumbs - subjects" do - login_as(@user, :scope => :user) + it "checks document set breadcrumbs - subjects", js: true do + login_as(@user, scope: :user) + @article = @set.articles.first visit dashboard_path page.find('.maincol').find('a', text: @set.title).click @@ -278,15 +279,24 @@ expect(page).to have_selector('.category-article', text: @article.title) expect(page).not_to have_selector('.category-article', text: @collection.articles.last.title) page.find('a', text: @article.title).click - expect(page.find('.breadcrumbs')).to have_selector('a', text: @set.title) + expect(page).to have_selector('.breadcrumbs') + expect(page).to have_selector('a', text: @set.title) + page.find('.tabs').click_link("Settings") - expect(page.find('.breadcrumbs')).to have_selector('a', text: @set.title) + expect(page).to have_selector('.breadcrumbs') + expect(page).to have_selector('a', text: @set.title) + click_button 'Autolink' - expect(page.find('.breadcrumbs')).to have_selector('a', text: @set.title) + expect(page).to have_selector('.breadcrumbs') + expect(page).to have_selector('a', text: @set.title) + click_button('Save Changes') - expect(page.find('.breadcrumbs')).to have_selector('a', text: @set.title) + expect(page).to have_selector('.breadcrumbs') + expect(page).to have_selector('a', text: @set.title) + page.find('.tabs').click_link("Versions") - expect(page.find('.breadcrumbs')).to have_selector('a', text: @set.title) + expect(page).to have_selector('.breadcrumbs') + expect(page).to have_selector('a', text: @set.title) end it "checks document set subject tabs" do diff --git a/spec/fixtures/users.yml b/spec/fixtures/users.yml index efcaf4c5a7..44bc152512 100644 --- a/spec/fixtures/users.yml +++ b/spec/fixtures/users.yml @@ -13,7 +13,7 @@ user_2: id: 2 login: eleanor display_name: eleanor - real_name: + real_name: email: eleanor@test.com owner: false admin: false @@ -24,7 +24,7 @@ user_3: id: 3 login: harry display_name: harry - real_name: + real_name: email: harry@test.com owner: false admin: false @@ -41,22 +41,22 @@ user_4: admin: false activity_email: true account_type: Legacy - paid_date: <%= 1.month.from_now.to_s :db %> - start_date: <%= 1.month.ago.to_s :db %> + paid_date: <%= 1.month.from_now.to_fs(:db) %> + start_date: <%= 1.month.ago.to_fs(:db) %> encrypted_password: d1e821c1470f974572d71053060fed5ba84f7c8d password_salt: y7iu5sLXusNg5yZYBNhc user_5: id: 5 login: julia display_name: julia - real_name: + real_name: email: julia@test.com owner: true admin: true activity_email: true account_type: Small Organization - paid_date: <%= 2.weeks.from_now.to_s :db %> - start_date: <%= 1.week.ago.to_s :db %> + paid_date: <%= 2.weeks.from_now.to_fs(:db) %> + start_date: <%= 1.week.ago.to_fs(:db) %> encrypted_password: 8d73474e08146841dc65db3fd94c55e78cde7410 password_salt: R2-cytow2JEPt3jD3Ts1 user_6: @@ -74,69 +74,69 @@ user_7: id: 7 login: brian display_name: Brian - real_name: + real_name: email: brian@test.com owner: true admin: false activity_email: true account_type: Trial - paid_date: <%= 1.month.ago.to_s :db %> - start_date: <%= 1.month.ago.to_s :db %> + paid_date: <%= 1.month.ago.to_fs(:db) %> + start_date: <%= 1.month.ago.to_fs(:db) %> encrypted_password: d1e821c1470f974572d71053060fed5ba84f7c8d password_salt: y7iu5sLXusNg5yZYBNhc user_8: id: 8 login: wakanda display_name: Wakanda - real_name: + real_name: email: wakanda@example.org owner: true admin: true activity_email: true - account_type: - paid_date: <%= 1.month.ago.to_s :db %> - start_date: <%= 1.month.ago.to_s :db %> + account_type: + paid_date: <%= 1.month.ago.to_fs(:db) %> + start_date: <%= 1.month.ago.to_fs(:db) %> encrypted_password: d1e821c1470f974572d71053060fed5ba84f7c8d password_salt: y7iu5sLXusNg5yZYBNhc user_9: id: 9 login: shuri display_name: Shuri - real_name: + real_name: email: shuri@example.org owner: false admin: false activity_email: true - account_type: - paid_date: <%= 1.month.ago.to_s :db %> - start_date: <%= 1.month.ago.to_s :db %> + account_type: + paid_date: <%= 1.month.ago.to_fs(:db) %> + start_date: <%= 1.month.ago.to_fs(:db) %> encrypted_password: d1e821c1470f974572d71053060fed5ba84f7c8d password_salt: y7iu5sLXusNg5yZYBNhc user_10: id: 10 login: carlos display_name: Carlos - real_name: + real_name: email: carlos@example.org owner: true admin: false activity_email: true - account_type: - paid_date: <%= 1.month.ago.to_s :db %> - start_date: <%= 1.month.ago.to_s :db %> + account_type: + paid_date: <%= 1.month.ago.to_fs(:db) %> + start_date: <%= 1.month.ago.to_fs(:db) %> encrypted_password: d1e821c1470f974572d71053060fed5ba84f7c8d password_salt: y7iu5sLXusNg5yZYBNhc user_11: id: 11 login: jose display_name: Jose - real_name: + real_name: email: jose@example.org owner: false admin: false activity_email: true - account_type: - paid_date: <%= 1.month.ago.to_s :db %> - start_date: <%= 1.month.ago.to_s :db %> + account_type: + paid_date: <%= 1.month.ago.to_fs(:db) %> + start_date: <%= 1.month.ago.to_fs(:db) %> encrypted_password: d1e821c1470f974572d71053060fed5ba84f7c8d password_salt: y7iu5sLXusNg5yZYBNhc diff --git a/spec/interactors/article/combine_spec.rb b/spec/interactors/article/combine_spec.rb index c7a847cea7..2a62793d31 100644 --- a/spec/interactors/article/combine_spec.rb +++ b/spec/interactors/article/combine_spec.rb @@ -23,10 +23,10 @@ let(:from_article_ids) { [from_article.id] } let(:result) do - described_class.call( + described_class.new( article: to_article, from_article_ids: from_article_ids - ) + ).call end it 'combines articles and updates source texts of related models' do diff --git a/spec/interactors/article/destroy_spec.rb b/spec/interactors/article/destroy_spec.rb index b561a38fe3..b5640be4db 100644 --- a/spec/interactors/article/destroy_spec.rb +++ b/spec/interactors/article/destroy_spec.rb @@ -6,11 +6,11 @@ let!(:article) { create(:article, collection: collection) } let(:result) do - described_class.call( + described_class.new( article: article, user: user, collection: collection - ) + ).call end context 'with referring links' do @@ -28,11 +28,11 @@ let(:other_user) { User.find_by(login: NEW_OWNER) } let(:result) do - described_class.call( + described_class.new( article: article, user: other_user, collection: collection - ) + ).call end it 'fails to delete' do diff --git a/spec/interactors/article/update_spec.rb b/spec/interactors/article/update_spec.rb index 6e66f242cd..6584d56f93 100644 --- a/spec/interactors/article/update_spec.rb +++ b/spec/interactors/article/update_spec.rb @@ -30,10 +30,10 @@ end let(:result) do - described_class.call( + described_class.new( article: article.reload, article_params: article_params - ) + ).call end it 'updates article and source texts of related models' do diff --git a/spec/interactors/work/metadata/export_csv_spec.rb b/spec/interactors/work/metadata/export_csv_spec.rb index 9e623b3f61..ee668f2b24 100644 --- a/spec/interactors/work/metadata/export_csv_spec.rb +++ b/spec/interactors/work/metadata/export_csv_spec.rb @@ -28,7 +28,7 @@ let!(:work_2) { create(:work, collection: collection, owner_user_id: owner.id) } let(:result) do - described_class.call(collection: collection.reload, works: collection.works) + described_class.new(collection: collection.reload, works: collection.works).call end let(:expected_headers) do diff --git a/spec/interactors/work/metadata/import_csv_spec.rb b/spec/interactors/work/metadata/import_csv_spec.rb index 3391f07240..bc73c73573 100644 --- a/spec/interactors/work/metadata/import_csv_spec.rb +++ b/spec/interactors/work/metadata/import_csv_spec.rb @@ -150,7 +150,7 @@ end let(:result) do - described_class.call(metadata_file: metadata_file, collection: collection.reload) + described_class.new(metadata_file: metadata_file, collection: collection.reload).call end it 'imports csv' do diff --git a/spec/models/deed_spec.rb b/spec/models/deed_spec.rb index d13a44f21c..b3cfb58965 100644 --- a/spec/models/deed_spec.rb +++ b/spec/models/deed_spec.rb @@ -21,9 +21,9 @@ allow_any_instance_of(Deed).to receive(:calculate_prerender) allow_any_instance_of(Deed).to receive(:calculate_prerender_mailer) - first_deed = create(:deed, deed_type: deed_type) - sleep 0.5 - second_deed = create(:deed, deed_type: deed_type) + base_time = Time.now + first_deed = create(:deed, deed_type: deed_type, created_at: base_time) + second_deed = create(:deed, deed_type: deed_type, created_at: base_time + 1.day) expect(Deed.order_by_recent_activity.first).to eq(second_deed) diff --git a/spec/requests/metadata_controller_spec.rb b/spec/requests/metadata_controller_spec.rb index 421f174e80..5b29b5d182 100644 --- a/spec/requests/metadata_controller_spec.rb +++ b/spec/requests/metadata_controller_spec.rb @@ -38,7 +38,7 @@ describe '#create' do let(:action_path) { collection_metadata_create_path } let(:file) do - result = Work::Metadata::ExportCsv.call(collection: collection, works: Work.where(id: work.id)) + result = Work::Metadata::ExportCsv.new(collection: collection, works: Work.where(id: work.id)).call temp_file = Tempfile.new(['metadata', '.csv']) temp_file.write(result.csv_string) temp_file.rewind diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 579f7c6a6c..2b4cdeeb4b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -118,10 +118,10 @@ def wait_for_upload_processing def fill_in_editor_field(text) - if page.has_field?('page_source_text') # we find page_source_text - fill_in('page_source_text', :with => text) - elsif page.has_field?('page_source_translation') # we find page_source_translation - fill_in('page_source_translation', :with => text) + if page.has_field?('page[source_text]') # we find page_source_text + fill_in('page[source_text]', with: text) + elsif page.has_field?('page[source_translation]') # we find page_source_translation + fill_in('page[source_translation]', with: text) else #codemirror script = "myCodeMirror.setValue(#{text.to_json});" page.execute_script(script) diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb deleted file mode 100644 index c7890e49c6..0000000000 --- a/spec/support/factory_bot.rb +++ /dev/null @@ -1,3 +0,0 @@ -RSpec.configure do |config| - config.include FactoryBot::Syntax::Methods -end