diff --git a/Gemfile b/Gemfile index c2ff8396c23e17d393397955bfc098a9378a5ba0..df6f772a13e2f24f311b16eb7f0ede426128f59a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,85 +1,85 @@ -source 'https://rubygems.org' +source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.1.3' +ruby "3.1.3" # Infrastructure -gem 'activestorage-scaleway-service'#, path: '../activestorage-scaleway-service' -gem 'active_storage_validations' -gem 'angularjs-rails' -gem 'aws-sdk-s3' -gem 'bootstrap' -gem 'bootsnap', '>= 1.4.4', require: false -gem 'bootstrap5-kaminari-views' -gem 'breadcrumbs_on_rails' -gem 'bugsnag' -gem 'cancancan', '3.3.0' -gem 'cocoon', '~> 1.2' -gem 'country_select' -gem 'curation'#, path: '../../arnaudlevy/curation' -gem 'delayed_job_active_record' -gem 'delayed_job_web' -gem 'devise' -gem 'devise-i18n' -gem 'enum_help' -gem 'faceted_search'#, path: '../../noesya/faceted_search' -gem 'font-awesome-sass' -gem 'front_matter_parser' -gem 'gdpr' -gem 'gitlab' -gem 'has_scope', '~> 0.8.0' -gem 'hash_dot' -gem 'image_processing' -gem 'jbuilder' -gem 'jquery-rails' +gem "activestorage-scaleway-service"#, path: "../activestorage-scaleway-service" +gem "active_storage_validations", "~> 1.0" +gem "angularjs-rails" +gem "aws-sdk-s3" +gem "bootstrap" +gem "bootsnap", ">= 1.4.4", require: false +gem "bootstrap5-kaminari-views" +gem "breadcrumbs_on_rails" +gem "bugsnag" +gem "cancancan", "3.3.0" +gem "cocoon", "~> 1.2" +gem "country_select" +gem "curation"#, path: "../../arnaudlevy/curation" +gem "delayed_job_active_record" +gem "delayed_job_web" +gem "devise" +gem "devise-i18n" +gem "enum_help" +gem "faceted_search"#, path: "../../noesya/faceted_search" +gem "font-awesome-sass" +gem "front_matter_parser" +gem "gdpr" +gem "gitlab" +gem "has_scope", "~> 0.8.0" +gem "hash_dot" +gem "image_processing" +gem "jbuilder" +gem "jquery-rails" gem "jquery-ui-rails", "~> 6.0.1" -gem 'kamifusen'#, path: '../kamifusen' -gem 'kaminari' -gem 'mini_magick' -gem 'octokit' -gem 'omniauth-rails_csrf_protection', '~> 1.0' -gem 'omniauth-saml', '~> 2.0' -gem 'pg', '~> 1.1' -gem 'puma' -gem 'rails', '~> 7.0' -gem 'rails-autocomplete', '~> 2.0' -gem 'rails-i18n' -gem 'roo', "~> 2.9" -gem 'sanitize' -gem 'sassc-rails' -# gem 'scout_apm', '~> 5.1' -gem 'sib-api-v3-sdk' -gem 'simple-navigation' -gem 'simple_form' -gem 'simple_form_bs5_file_input'#, path: '../simple_form_bs5_file_input' -gem 'simple_form_password_with_hints'#, path: '../simple_form_password_with_hints' +gem "kamifusen"#, path: "../kamifusen" +gem "kaminari" +gem "mini_magick" +gem "octokit" +gem "omniauth-rails_csrf_protection", "~> 1.0" +gem "omniauth-saml", "~> 2.0" +gem "pg", "~> 1.1" +gem "puma" +gem "rails", "~> 7.0" +gem "rails-autocomplete", "~> 2.0" +gem "rails-i18n" +gem "roo", "~> 2.9" +gem "sanitize" +gem "sassc-rails" +# gem "scout_apm", "~> 5.1" +gem "sib-api-v3-sdk" +gem "simple-navigation" +gem "simple_form" +gem "simple_form_bs5_file_input"#, path: "../simple_form_bs5_file_input" +gem "simple_form_password_with_hints"#, path: "../simple_form_password_with_hints" gem "sprockets-rails", "~> 3.4" -gem 'summernote-rails', git: 'https://github.com/noesya/summernote-rails.git', branch: 'activestorage' -# gem 'summernote-rails', path: '../summernote-rails' -gem 'two_factor_authentication', git: 'https://github.com/noesya/two_factor_authentication.git' -# gem 'two_factor_authentication', path: '../two_factor_authentication' -gem 'unsplash' +gem "summernote-rails", git: "https://github.com/noesya/summernote-rails.git", branch: "activestorage" +# gem "summernote-rails", path: "../summernote-rails" +gem "two_factor_authentication", git: "https://github.com/noesya/two_factor_authentication.git" +# gem "two_factor_authentication", path: "../two_factor_authentication" +gem "unsplash" group :development, :test do - gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] - gem 'figaro' - gem 'vcr' - gem 'webmock' + gem "byebug", platforms: [:mri, :mingw, :x64_mingw] + gem "figaro" + gem "vcr" + gem "webmock" end group :development do - gem 'annotate' - gem 'listen', '~> 3.3' - gem 'rack-mini-profiler', '~> 2.0' - gem 'spring' - gem 'web-console', '>= 4.1.0' + gem "annotate" + gem "listen", "~> 3.3" + gem "rack-mini-profiler", "~> 2.0" + gem "spring" + gem "web-console", ">= 4.1.0" end group :test do - gem 'capybara', '>= 3.26' - gem 'selenium-webdriver' - gem 'webdrivers' + gem "capybara", ">= 3.26" + gem "selenium-webdriver" + gem "webdrivers" gem "simplecov", require: false end -gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] +gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/Gemfile.lock b/Gemfile.lock index 4604f509e9dd8dadab0e010c51c6b1397d7adf43..7bc762f5d2d38bf20f70172f112b20353a54a7f3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,7 +9,7 @@ GIT GIT remote: https://github.com/noesya/two_factor_authentication.git - revision: ab9734c72d389aefe8ff566d41a0c35bfe5ec989 + revision: 4574ece65da41397dd852001e22a0c3b9ee3d01e specs: two_factor_authentication (4.0.0) devise @@ -103,13 +103,13 @@ GEM autoprefixer-rails (10.4.7.0) execjs (~> 2) aws-eventstream (1.2.0) - aws-partitions (1.669.0) - aws-sdk-core (3.168.2) + aws-partitions (1.688.0) + aws-sdk-core (3.168.4) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.60.0) + aws-sdk-kms (1.61.0) aws-sdk-core (~> 3, >= 3.165.0) aws-sigv4 (~> 1.1) aws-sdk-s3 (1.117.2) @@ -131,7 +131,7 @@ GEM rails (>= 3.1) breadcrumbs_on_rails (4.1.0) railties (>= 5.0) - bugsnag (6.25.0) + bugsnag (6.25.1) concurrent-ruby (~> 1.0) builder (3.2.4) byebug (11.1.3) @@ -145,12 +145,11 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - childprocess (4.1.0) cocoon (1.2.15) concurrent-ruby (1.1.10) - countries (5.2.0) + countries (5.3.0) unaccent (~> 0.3) - country_select (8.0.0) + country_select (8.0.1) countries (~> 5.0) crack (0.4.5) rexml @@ -159,6 +158,7 @@ GEM htmlentities metainspector (~> 5.12) nokogiri + date (3.3.3) delayed_job (4.1.11) activesupport (>= 3.0, < 8.0) delayed_job_active_record (4.1.7) @@ -183,14 +183,14 @@ GEM encryptor (3.0.0) enum_help (0.0.19) activesupport (>= 3.0.0) - erubi (1.11.0) + erubi (1.12.0) ethon (0.16.0) ffi (>= 1.15.0) execjs (2.8.1) faceted_search (3.5.16) font-awesome-sass rails (>= 5.2.0) - faraday (2.7.1) + faraday (2.7.2) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-cookie_jar (0.0.7) @@ -235,8 +235,8 @@ GEM htmlentities (4.3.4) http-cookie (1.0.5) domain_name (~> 0.5) - httparty (0.20.0) - mime-types (~> 3.0) + httparty (0.21.0) + mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) i18n (1.12.0) concurrent-ruby (~> 1.0) @@ -255,8 +255,8 @@ GEM railties (>= 3.2.16) js_cookie_rails (2.2.0) railties (>= 3.1) - json (2.6.2) - jwt (2.5.0) + json (2.6.3) + jwt (2.6.0) kamifusen (1.11.2) image_processing rails @@ -275,11 +275,14 @@ GEM listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.19.0) + loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.0) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) matrix (0.4.2) metainspector (5.13.1) @@ -295,32 +298,30 @@ GEM nesty (~> 1.0) nokogiri (~> 1.13) method_source (1.0.0) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) - mini_magick (4.11.0) + mini_magick (4.12.0) mini_mime (1.1.2) - minitest (5.16.3) + minitest (5.17.0) msgpack (1.6.0) multi_xml (0.6.0) multipart-post (2.2.3) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) nesty (1.0.2) - net-imap (0.3.1) + net-imap (0.3.4) + date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.1.3) + net-protocol (0.2.1) timeout net-smtp (0.3.3) net-protocol nio4r (2.5.8) - nokogiri (1.13.9-arm64-darwin) + nokogiri (1.13.10-arm64-darwin) racc (~> 1.4) - nokogiri (1.13.9-x86_64-darwin) + nokogiri (1.13.10-x86_64-darwin) racc (~> 1.4) - nokogiri (1.13.9-x86_64-linux) + nokogiri (1.13.10-x86_64-linux) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -345,14 +346,14 @@ GEM orm_adapter (0.5.0) pg (1.4.5) popper_js (2.11.6) - public_suffix (5.0.0) - puma (6.0.0) + public_suffix (5.0.1) + puma (6.0.2) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.4) + racc (1.6.2) + rack (2.2.5) rack-mini-profiler (2.3.4) rack (>= 1.2.0) - rack-protection (3.0.4) + rack-protection (3.0.5) rack rack-test (2.0.2) rack (>= 1.3) @@ -375,8 +376,8 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) + rails-html-sanitizer (1.4.4) + loofah (~> 2.19, >= 2.19.1) rails-i18n (7.0.6) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) @@ -400,9 +401,9 @@ GEM roo (2.9.0) nokogiri (~> 1) rubyzip (>= 1.3.0, < 3.0.0) - rotp (6.2.1) - ruby-saml (1.14.0) - nokogiri (>= 1.10.5) + rotp (6.2.2) + ruby-saml (1.15.0) + nokogiri (>= 1.13.10) rexml ruby-vips (2.1.4) ffi (~> 1.12) @@ -422,12 +423,11 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - selenium-webdriver (4.6.1) - childprocess (>= 0.5, < 5.0) + selenium-webdriver (4.7.1) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sib-api-v3-sdk (9.0.0) + sib-api-v3-sdk (9.1.0) addressable (~> 2.3, >= 2.3.0) json (~> 2.1, >= 2.1.0) typhoeus (~> 1.0, >= 1.0.1) @@ -442,24 +442,24 @@ GEM simple_form_password_with_hints (0.0.7) rails simple_form - simplecov (0.21.2) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - sinatra (3.0.4) + sinatra (3.0.5) mustermann (~> 3.0) rack (~> 2.2, >= 2.2.4) - rack-protection (= 3.0.4) + rack-protection (= 3.0.5) tilt (~> 2.0) snaky_hash (2.0.1) hashie version_gem (~> 1.1, >= 1.1.1) spring (4.1.0) - sprockets (4.1.1) + sprockets (4.2.0) concurrent-ruby (~> 1.0) - rack (> 1, < 3) + rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) @@ -468,7 +468,7 @@ GEM unicode-display_width (>= 1.1.1, < 3) thor (1.2.1) tilt (2.0.11) - timeout (0.3.0) + timeout (0.3.1) typhoeus (1.4.0) ethon (>= 0.9.0) tzinfo (2.0.5) @@ -477,7 +477,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.8.2) - unicode-display_width (2.3.0) + unicode-display_width (2.4.2) unsplash (3.0.0) faraday-multipart (~> 1.0.4) httparty (~> 0.20) @@ -516,7 +516,7 @@ PLATFORMS x86_64-linux DEPENDENCIES - active_storage_validations + active_storage_validations (~> 1.0) activestorage-scaleway-service angularjs-rails annotate diff --git a/app/models/communication/block.rb b/app/models/communication/block.rb index 14a359cd07ab52aa8587552cba79df76a64b82e6..4b28873c1a4834582c1efc271a31a59cc3bfbd95 100644 --- a/app/models/communication/block.rb +++ b/app/models/communication/block.rb @@ -28,7 +28,7 @@ class Communication::Block < ApplicationRecord include WithPosition include Accessible - IMAGE_MAX_SIZE = 5000 # ko + IMAGE_MAX_SIZE = 5.megabytes belongs_to :about, polymorphic: true diff --git a/app/models/university.rb b/app/models/university.rb index 949282ea77eda64a894f66afe7a3331c742738d1..96f44ec4a8cf892d7a063d72b354b6ab28550507 100644 --- a/app/models/university.rb +++ b/app/models/university.rb @@ -48,7 +48,7 @@ class University < ApplicationRecord validates_presence_of :name validates :sms_sender_name, presence: true, length: { maximum: 11 } - validates :logo, size: { less_than: 5.megabytes } + validates :logo, size: { less_than: 1.megabytes } after_destroy :destroy_remaining_blobs diff --git a/app/views/admin/communication/blocks/edit.html.erb b/app/views/admin/communication/blocks/edit.html.erb index 241879467a16a89ddf6331eb43cafac1e4802fe4..7ac4162144fff987ede45d0942a1be3c9c06f919 100644 --- a/app/views/admin/communication/blocks/edit.html.erb +++ b/app/views/admin/communication/blocks/edit.html.erb @@ -69,9 +69,9 @@ }, uploadFile(file, object, key) { var url = this.directUpload.url, - size = Math.round(file.size / 1024); - if (size > <%= Communication::Block::IMAGE_MAX_SIZE %>) { - alert("<%= t('admin.communication.blocks.alerts.image_is_too_big').html_safe %> (" + size + " ko > "+ <%= Communication::Block::IMAGE_MAX_SIZE %> +" ko)"); + size = Math.round(file.size / 1024 / 1024); + if (file.size > <%= Communication::Block::IMAGE_MAX_SIZE %>) { + alert("<%= t('admin.communication.blocks.alerts.image_is_too_big').html_safe %> (" + size + " Mo > <%= number_to_human_size Communication::Block::IMAGE_MAX_SIZE %>)"); return; } var upload = new ActiveStorage.DirectUpload(file, url);