diff --git a/.github/workflows/build_app.yml b/.github/workflows/build_app.yml index db908ff..9cd9017 100644 --- a/.github/workflows/build_app.yml +++ b/.github/workflows/build_app.yml @@ -3,12 +3,12 @@ on: inputs: ruby_version: description: 'Ruby Version' - default: "3.2.2" + default: "3.3.4" type: string required: false node_version: description: 'Node version' - default: '18.17.1' + default: '22.14.0' required: false type: string jobs: @@ -55,6 +55,10 @@ jobs: - run: bundle exec rake test_app name: Create test app shell: "bash" + - run: | + rm -f ./spec/decidim_dummy_app/app/services/dummy_signature_handler.rb + rm -f ./spec/decidim_dummy_app/app/services/dummy_sms_mobile_phone_validator.rb + name: Remove Initiative-dependent dummy files - run: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots name: Create the screenshots folder shell: "bash" diff --git a/.github/workflows/ci_additional_authorization_handler.yml b/.github/workflows/ci_additional_authorization_handler.yml index d0d94c7..ac23edb 100644 --- a/.github/workflows/ci_additional_authorization_handler.yml +++ b/.github/workflows/ci_additional_authorization_handler.yml @@ -14,8 +14,8 @@ on: env: CI: "true" - RUBY_VERSION: 3.2.2 - NODE_VERSION: 18.17.1 + RUBY_VERSION: 3.3.4 + NODE_VERSION: 22.14.0 concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} diff --git a/.github/workflows/test_app.yml b/.github/workflows/test_app.yml index 0727185..c008a36 100644 --- a/.github/workflows/test_app.yml +++ b/.github/workflows/test_app.yml @@ -3,7 +3,7 @@ on: inputs: ruby_version: description: 'Ruby Version' - default: "3.2.2" + default: "3.3.4" required: false type: string test_command: @@ -13,7 +13,7 @@ on: chrome_version: description: 'Chrome & Chromedriver version' required: false - default: "126.0.6478.182" + default: "136.0.7103.92" type: string jobs: @@ -57,7 +57,7 @@ jobs: ruby-version: ${{ inputs.ruby_version }} - run: | sudo apt update - sudo apt install libu2f-udev + sudo apt install libu2f-udev imagemagick wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${{inputs.chrome_version}}-1_amd64.deb sudo dpkg -i /tmp/chrome.deb rm /tmp/chrome.deb diff --git a/.ruby-version b/.ruby-version index be94e6f..a0891f5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.2 +3.3.4 diff --git a/Gemfile b/Gemfile index c49c8fb..33db689 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source "https://rubygems.org" ruby RUBY_VERSION -gem "decidim", "~> 0.29.1" +gem "decidim", "~> 0.31.0" gem "decidim-additional_authorization_handler", path: "." gem "bootsnap", "~> 1.4" @@ -13,7 +13,7 @@ gem "puma", ">= 6.3.1" group :development, :test do gem "byebug", "~> 11.0", platform: :mri - gem "decidim-dev", "~> 0.29.1" + gem "decidim-dev", "~> 0.31.0" end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index e712e2c..2630476 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,103 +1,112 @@ PATH remote: . specs: - decidim-additional_authorization_handler (1.0.0) - decidim-core (~> 0.29.0) + decidim-additional_authorization_handler (1.1.0) + decidim-core (~> 0.31.0) GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.6) - actionpack (= 7.0.8.6) - activesupport (= 7.0.8.6) + actioncable (7.2.3) + actionpack (= 7.2.3) + activesupport (= 7.2.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.6) - actionpack (= 7.0.8.6) - activejob (= 7.0.8.6) - activerecord (= 7.0.8.6) - activestorage (= 7.0.8.6) - activesupport (= 7.0.8.6) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.0.8.6) - actionpack (= 7.0.8.6) - actionview (= 7.0.8.6) - activejob (= 7.0.8.6) - activesupport (= 7.0.8.6) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.8.6) - actionview (= 7.0.8.6) - activesupport (= 7.0.8.6) - rack (~> 2.0, >= 2.2.4) + zeitwerk (~> 2.6) + actionmailbox (7.2.3) + actionpack (= 7.2.3) + activejob (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) + mail (>= 2.8.0) + actionmailer (7.2.3) + actionpack (= 7.2.3) + actionview (= 7.2.3) + activejob (= 7.2.3) + activesupport (= 7.2.3) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.3) + actionview (= 7.2.3) + activesupport (= 7.2.3) + cgi + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.3) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.6) - actionpack (= 7.0.8.6) - activerecord (= 7.0.8.6) - activestorage (= 7.0.8.6) - activesupport (= 7.0.8.6) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.3) + actionpack (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.6) - activesupport (= 7.0.8.6) + actionview (7.2.3) + activesupport (= 7.2.3) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) + cgi + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) active_link_to (1.0.5) actionpack addressable - activejob (7.0.8.6) - activesupport (= 7.0.8.6) + activejob (7.2.3) + activesupport (= 7.2.3) globalid (>= 0.3.6) - activemodel (7.0.8.6) - activesupport (= 7.0.8.6) - activerecord (7.0.8.6) - activemodel (= 7.0.8.6) - activesupport (= 7.0.8.6) - activestorage (7.0.8.6) - actionpack (= 7.0.8.6) - activejob (= 7.0.8.6) - activerecord (= 7.0.8.6) - activesupport (= 7.0.8.6) + activemodel (7.2.3) + activesupport (= 7.2.3) + activerecord (7.2.3) + activemodel (= 7.2.3) + activesupport (= 7.2.3) + timeout (>= 0.4.0) + activestorage (7.2.3) + actionpack (= 7.2.3) + activejob (= 7.2.3) + activerecord (= 7.2.3) + activesupport (= 7.2.3) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8.6) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (7.2.3) + 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) - acts_as_list (1.2.4) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + acts_as_list (1.2.6) activerecord (>= 6.1) activesupport (>= 6.1) - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) - ast (2.4.2) - base64 (0.2.0) - batch-loader (1.5.0) - bcrypt (3.1.20) - better_html (2.1.1) - actionview (>= 6.0) - activesupport (>= 6.0) + addressable (2.8.8) + public_suffix (>= 2.0.2, < 8.0) + ast (2.4.3) + base64 (0.3.0) + batch-loader (2.0.6) + bcrypt (3.1.21) + benchmark (0.5.0) + better_html (2.2.0) + actionview (>= 7.0) + activesupport (>= 7.0) ast (~> 2.0) erubi (~> 1.4) parser (>= 2.4) smart_properties - bigdecimal (3.1.8) + bigdecimal (4.0.1) bindex (0.8.1) - bootsnap (1.18.4) + bootsnap (1.20.1) msgpack (~> 1.2) - browser (2.7.1) + browser (6.2.0) builder (3.3.0) - bullet (7.1.6) + bullet (8.0.8) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) @@ -121,134 +130,151 @@ GEM cells-rails (0.1.6) actionpack (>= 5.0) cells (>= 4.1.6, < 5.0.0) + cgi (0.5.1) charlock_holmes (0.7.9) + chartkick (5.1.5) childprocess (5.1.0) logger (~> 1.5) - commonmarker (0.23.11) - concurrent-ruby (1.3.4) - crack (1.0.0) + chunky_png (1.4.0) + cmdparse (3.0.7) + commonmarker (0.23.12) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) + crack (1.0.1) bigdecimal rexml crass (1.0.6) - css_parser (1.19.1) + css_parser (1.21.1) addressable - csv (3.3.0) - dartsass (1.49.8) - date (3.4.1) + csv (3.3.5) + data_migrate (11.3.1) + activerecord (>= 6.1) + railties (>= 6.1) + date (3.5.1) date_validator (0.12.0) activemodel (>= 3) activesupport (>= 3) - decidim (0.29.1) - decidim-accountability (= 0.29.1) - decidim-admin (= 0.29.1) - decidim-api (= 0.29.1) - decidim-assemblies (= 0.29.1) - decidim-blogs (= 0.29.1) - decidim-budgets (= 0.29.1) - decidim-comments (= 0.29.1) - decidim-core (= 0.29.1) - decidim-debates (= 0.29.1) - decidim-forms (= 0.29.1) - decidim-generators (= 0.29.1) - decidim-meetings (= 0.29.1) - decidim-pages (= 0.29.1) - decidim-participatory_processes (= 0.29.1) - decidim-proposals (= 0.29.1) - decidim-sortitions (= 0.29.1) - decidim-surveys (= 0.29.1) - decidim-system (= 0.29.1) - decidim-verifications (= 0.29.1) - decidim-accountability (0.29.1) - decidim-comments (= 0.29.1) - decidim-core (= 0.29.1) - decidim-admin (0.29.1) + decidim (0.31.0) + decidim-accountability (= 0.31.0) + decidim-admin (= 0.31.0) + decidim-api (= 0.31.0) + decidim-assemblies (= 0.31.0) + decidim-blogs (= 0.31.0) + decidim-budgets (= 0.31.0) + decidim-comments (= 0.31.0) + decidim-core (= 0.31.0) + decidim-debates (= 0.31.0) + decidim-forms (= 0.31.0) + decidim-generators (= 0.31.0) + decidim-meetings (= 0.31.0) + decidim-pages (= 0.31.0) + decidim-participatory_processes (= 0.31.0) + decidim-proposals (= 0.31.0) + decidim-sortitions (= 0.31.0) + decidim-surveys (= 0.31.0) + decidim-system (= 0.31.0) + decidim-verifications (= 0.31.0) + decidim-accountability (0.31.0) + decidim-comments (= 0.31.0) + decidim-core (= 0.31.0) + decidim-admin (0.31.0) active_link_to (~> 1.0) - decidim-core (= 0.29.1) + decidim-core (= 0.31.0) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0, >= 2.0.9) - decidim-api (0.29.1) - decidim-core (= 0.29.1) - graphql (~> 2.2.6) - graphql-docs (~> 4.0) + decidim-api (0.31.0) + decidim-core (= 0.31.0) + devise-jwt (~> 0.12.1) + graphql (~> 2.4.0, >= 2.4.17) + graphql-docs (~> 5.0) rack-cors (~> 1.0) - decidim-assemblies (0.29.1) - decidim-core (= 0.29.1) - decidim-blogs (0.29.1) - decidim-admin (= 0.29.1) - decidim-comments (= 0.29.1) - decidim-core (= 0.29.1) - decidim-budgets (0.29.1) - decidim-comments (= 0.29.1) - decidim-core (= 0.29.1) - decidim-comments (0.29.1) - decidim-core (= 0.29.1) + decidim-assemblies (0.31.0) + decidim-core (= 0.31.0) + decidim-blogs (0.31.0) + decidim-admin (= 0.31.0) + decidim-comments (= 0.31.0) + decidim-core (= 0.31.0) + decidim-budgets (0.31.0) + decidim-comments (= 0.31.0) + decidim-core (= 0.31.0) + decidim-comments (0.31.0) + decidim-core (= 0.31.0) redcarpet (~> 3.5, >= 3.5.1) - decidim-core (0.29.1) + decidim-core (0.31.0) active_link_to (~> 1.0) acts_as_list (~> 1.0) - batch-loader (~> 1.2) - browser (~> 2.7) + batch-loader (~> 2.0) + browser (~> 6.2.0) cells-erb (~> 0.1.0) cells-rails (~> 0.1.3) charlock_holmes (~> 0.7) + chartkick (~> 5.1.2) + concurrent-ruby (~> 1.3.0) + data_migrate (~> 11.3) date_validator (~> 0.12.0) devise (~> 4.7) - devise-i18n (~> 1.2, < 1.11.1) + devise-i18n (~> 1.2) diffy (~> 3.3) doorkeeper (~> 5.6, >= 5.6.6) doorkeeper-i18n (~> 4.0) file_validators (~> 3.0) fog-local (~> 0.6) - foundation_rails_helper (~> 4.0) geocoder (~> 1.8) hashdiff (>= 0.4.0, < 2.0.0) + hexapdf (~> 1.1.0) image_processing (~> 1.2) invisible_captcha (~> 0.12) kaminari (~> 1.2, >= 1.2.1) loofah (~> 2.19, >= 2.19.1) mime-types (>= 1.16, < 4.0) mini_magick (~> 4.9) - net-smtp (~> 0.3.1) + net-smtp (~> 0.5.0) nokogiri (~> 1.16, >= 1.16.2) omniauth (~> 2.0) omniauth-facebook (~> 5.0) omniauth-google-oauth2 (~> 1.0) omniauth-rails_csrf_protection (~> 1.0) omniauth-twitter (~> 1.4) - paper_trail (~> 12.0) - pg (~> 1.4.0, < 2) + paper_trail (~> 16.0) + paranoia (~> 3.0.0) + pg (~> 1.5.0, < 2) pg_search (~> 2.2) premailer-rails (~> 1.10) - psych (~> 4.0) rack (~> 2.2, >= 2.2.8.1) rack-attack (~> 6.0) - rails (~> 7.0.8) + rails (~> 7.2.0, >= 7.2.2.2) rails-i18n (~> 7.0) - ransack (~> 3.2.1) + ransack (~> 4.2.0) redis (~> 4.1) - request_store (~> 1.5.0) + request_store (~> 1.7.0) + rqrcode (~> 2.2.0) rubyXL (~> 3.4) rubyzip (~> 2.0) - shakapacker (~> 7.1.0) - valid_email2 (~> 4.0) + shakapacker (~> 8.3.0) + valid_email2 (~> 7.0) web-push (~> 3.0) - wisper (~> 2.0) - decidim-debates (0.29.1) - decidim-comments (= 0.29.1) - decidim-core (= 0.29.1) - decidim-dev (0.29.1) - bullet (~> 7.1.6) + wisper (~> 3.0) + decidim-debates (0.31.0) + decidim-comments (= 0.31.0) + decidim-core (= 0.31.0) + decidim-dev (0.31.0) + bullet (~> 8.0.0) byebug (~> 11.0) capybara (~> 3.39) - decidim (= 0.29.1) - erb_lint (~> 0.4.0) + decidim-admin (= 0.31.0) + decidim-api (= 0.31.0) + decidim-comments (= 0.31.0) + decidim-core (= 0.31.0) + decidim-generators (= 0.31.0) + decidim-verifications (= 0.31.0) + erb_lint (~> 0.8.0) factory_bot_rails (~> 6.2) faker (~> 3.2) i18n-tasks (~> 1.0) nokogiri (~> 1.16, >= 1.16.2) parallel_tests (~> 4.2) - puma (~> 6.2, >= 6.3.1) + puma (~> 6.5) rails-controller-testing (~> 1.0) rspec (~> 3.12) rspec-cells (~> 0.3.7) @@ -256,15 +282,16 @@ GEM rspec-rails (~> 6.0) rspec-retry (~> 0.6.2) rspec_junit_formatter (~> 0.6.0) - rubocop (~> 1.65.0) - rubocop-capybara (~> 2.21) - rubocop-factory_bot (~> 2.26) - rubocop-faker (~> 1.1) - rubocop-performance (~> 1.21) - rubocop-rails (~> 2.25) - rubocop-rspec (~> 3.0) - rubocop-rspec_rails (~> 2.30) - rubocop-rubycw (~> 0.1) + rubocop (~> 1.78.0) + rubocop-capybara (~> 2.22.0, >= 2.22.1) + rubocop-factory_bot (~> 2.27.0) + rubocop-faker (~> 1.3, >= 1.3.0) + rubocop-graphql (~> 1.5, >= 1.5.6) + rubocop-performance (~> 1.25, >= 1.25.0) + rubocop-rails (~> 2.32.0, >= 2.32.0) + rubocop-rspec (~> 3.0, >= 3.6.0) + rubocop-rspec_rails (~> 2.31.0) + rubocop-rubycw (~> 0.2.0) selenium-webdriver (~> 4.9) simplecov (~> 0.22.0) simplecov-cobertura (~> 2.1.0) @@ -273,41 +300,39 @@ GEM w3c_rspec_validators (~> 0.3.0) webmock (~> 3.18) wisper-rspec (~> 1.0) - decidim-forms (0.29.1) - decidim-core (= 0.29.1) - wicked_pdf (~> 2.1) - wkhtmltopdf-binary (= 0.12.6.6) - decidim-generators (0.29.1) - decidim-core (= 0.29.1) - decidim-meetings (0.29.1) - decidim-core (= 0.29.1) - decidim-forms (= 0.29.1) + decidim-forms (0.31.0) + decidim-core (= 0.31.0) + decidim-generators (0.31.0) + decidim-core (= 0.31.0) + decidim-meetings (0.31.0) + decidim-core (= 0.31.0) + decidim-forms (= 0.31.0) icalendar (~> 2.5) - decidim-pages (0.29.1) - decidim-core (= 0.29.1) - decidim-participatory_processes (0.29.1) - decidim-core (= 0.29.1) - decidim-proposals (0.29.1) - decidim-comments (= 0.29.1) - decidim-core (= 0.29.1) - doc2text (~> 0.4.7) + decidim-pages (0.31.0) + decidim-core (= 0.31.0) + decidim-participatory_processes (0.31.0) + decidim-core (= 0.31.0) + decidim-proposals (0.31.0) + decidim-comments (= 0.31.0) + decidim-core (= 0.31.0) + doc2text (~> 0.4.0, >= 0.4.8) redcarpet (~> 3.5, >= 3.5.1) - decidim-sortitions (0.29.1) - decidim-admin (= 0.29.1) - decidim-comments (= 0.29.1) - decidim-core (= 0.29.1) - decidim-proposals (= 0.29.1) - decidim-surveys (0.29.1) - decidim-core (= 0.29.1) - decidim-forms (= 0.29.1) - decidim-system (0.29.1) + decidim-sortitions (0.31.0) + decidim-admin (= 0.31.0) + decidim-comments (= 0.31.0) + decidim-core (= 0.31.0) + decidim-proposals (= 0.31.0) + decidim-surveys (0.31.0) + decidim-core (= 0.31.0) + decidim-forms (= 0.31.0) + decidim-system (0.31.0) active_link_to (~> 1.0) - decidim-core (= 0.29.1) + decidim-core (= 0.31.0) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0, >= 2.0.9) - decidim-verifications (0.29.1) - decidim-core (= 0.29.1) + decidim-verifications (0.31.0) + decidim-core (= 0.31.0) declarative-builder (0.2.0) trailblazer-option (~> 0.1.0) declarative-option (0.1.0) @@ -317,58 +342,73 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.11.0) + devise-i18n (1.15.0) devise (>= 4.9.0) - devise_invitable (2.0.9) + rails-i18n + devise-jwt (0.12.1) + devise (~> 4.0) + warden-jwt_auth (~> 0.10) + devise_invitable (2.0.11) actionmailer (>= 5.0) devise (>= 4.6) - diff-lcs (1.5.1) - diffy (3.4.3) - doc2text (0.4.7) - nokogiri (>= 1.13.2, < 1.17.0) + diff-lcs (1.6.2) + diffy (3.4.4) + doc2text (0.4.8) + nokogiri (>= 1.18.2) rubyzip (~> 2.3.0) docile (1.4.1) - doorkeeper (5.8.0) + doorkeeper (5.8.2) railties (>= 5) doorkeeper-i18n (4.0.1) - erb_lint (0.4.0) + drb (2.2.3) + dry-auto_inject (1.1.0) + dry-core (~> 1.1) + zeitwerk (~> 2.6) + dry-configurable (1.3.0) + dry-core (~> 1.1) + zeitwerk (~> 2.6) + dry-core (1.2.0) + concurrent-ruby (~> 1.0) + logger + zeitwerk (~> 2.6) + erb (6.0.1) + erb_lint (0.8.0) activesupport better_html (>= 2.0.1) parser (>= 2.7.1.4) rainbow - rubocop + rubocop (>= 1) smart_properties erbse (0.1.4) temple - erubi (1.13.0) + erubi (1.13.1) escape_utils (1.3.0) - excon (1.2.2) + excon (1.3.2) + logger extended-markdown-filter (0.7.0) html-pipeline (~> 2.9) - factory_bot (6.5.0) - activesupport (>= 5.0.0) - factory_bot_rails (6.4.4) + factory_bot (6.5.6) + activesupport (>= 6.1.0) + factory_bot_rails (6.5.1) factory_bot (~> 6.5) - railties (>= 5.0.0) - faker (3.5.1) + railties (>= 6.1.0) + faker (3.5.3) i18n (>= 1.8.11, < 2) - faraday (2.12.1) + faraday (2.14.0) faraday-net_http (>= 2.0, < 3.5) json logger - faraday-net_http (3.4.0) - net-http (>= 0.5.0) - ffi (1.17.0) - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-aarch64-linux-musl) - ffi (1.17.0-arm-linux-gnu) - ffi (1.17.0-arm-linux-musl) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86-linux-gnu) - ffi (1.17.0-x86-linux-musl) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) - ffi (1.17.0-x86_64-linux-musl) + faraday-net_http (3.4.2) + net-http (~> 0.5) + ffi (1.17.3-aarch64-linux-gnu) + ffi (1.17.3-aarch64-linux-musl) + ffi (1.17.3-arm-linux-gnu) + ffi (1.17.3-arm-linux-musl) + ffi (1.17.3-arm64-darwin) + ffi (1.17.3-x86_64-darwin) + ffi (1.17.3-x86_64-linux-gnu) + ffi (1.17.3-x86_64-linux-musl) + fiber-storage (1.0.1) file_validators (3.0.0) activemodel (>= 3.2) mime-types (>= 1.0) @@ -377,62 +417,98 @@ GEM excon (~> 1.0) formatador (>= 0.2, < 2.0) mime-types - fog-local (0.8.0) + fog-local (0.9.0) fog-core (>= 1.27, < 3.0) - formatador (1.1.0) - foundation_rails_helper (4.0.1) - actionpack (>= 4.1, < 7.1) - activemodel (>= 4.1, < 7.1) - activesupport (>= 4.1, < 7.1) - railties (>= 4.1, < 7.1) + formatador (1.2.3) + reline gemoji (3.0.1) - geocoder (1.8.3) + geocoder (1.8.6) base64 (>= 0.1.0) csv (>= 3.0.0) - globalid (1.2.1) + geom2d (0.4.1) + globalid (1.3.0) activesupport (>= 6.1) - graphql (2.2.16) + google-protobuf (4.33.2) + bigdecimal + rake (>= 13) + google-protobuf (4.33.2-aarch64-linux-gnu) + bigdecimal + rake (>= 13) + google-protobuf (4.33.2-aarch64-linux-musl) + bigdecimal + rake (>= 13) + google-protobuf (4.33.2-arm64-darwin) + bigdecimal + rake (>= 13) + google-protobuf (4.33.2-x86_64-darwin) + bigdecimal + rake (>= 13) + google-protobuf (4.33.2-x86_64-linux-gnu) + bigdecimal + rake (>= 13) + google-protobuf (4.33.2-x86_64-linux-musl) + bigdecimal + rake (>= 13) + graphql (2.4.17) base64 - graphql-docs (4.0.0) + fiber-storage + logger + graphql-docs (5.2.0) commonmarker (~> 0.23, >= 0.23.6) - dartsass (~> 1.49) escape_utils (~> 1.2) extended-markdown-filter (~> 0.4) gemoji (~> 3.0) graphql (~> 2.0) html-pipeline (~> 2.14, >= 2.14.3) - hashdiff (1.1.2) - hashie (5.0.0) - highline (3.1.1) + logger (~> 1.6) + ostruct (~> 0.6) + sass-embedded (~> 1.58) + hashdiff (1.2.1) + hashie (5.1.0) + logger + hexapdf (1.1.1) + cmdparse (~> 3.0, >= 3.0.3) + geom2d (~> 0.4, >= 0.4.1) + openssl (>= 2.2.1) + strscan (>= 3.1.2) + highline (3.1.2) reline html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) - htmlentities (4.3.4) - i18n (1.14.6) + htmlentities (4.4.2) + i18n (1.14.8) concurrent-ruby (~> 1.0) - i18n-tasks (1.0.14) + i18n-tasks (1.1.2) activesupport (>= 4.0.2) ast (>= 2.1.0) erubi - highline (>= 2.0.0) + highline (>= 3.0.0) i18n parser (>= 3.2.2.1) + prism rails-i18n rainbow (>= 2.2.2, < 4.0) + ruby-progressbar (~> 1.8, >= 1.8.1) terminal-table (>= 1.5.1) - icalendar (2.10.3) + icalendar (2.12.1) + base64 ice_cube (~> 0.16) + logger ostruct ice_cube (0.17.0) - image_processing (1.13.0) - mini_magick (>= 4.9.5, < 5) + image_processing (1.14.0) + mini_magick (>= 4.9.5, < 6) ruby-vips (>= 2.0.17, < 3) invisible_captcha (0.13.0) rails (>= 3.2.0) - io-console (0.8.0) - json (2.9.0) - jwt (2.9.3) + io-console (0.8.2) + irb (1.16.0) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + json (2.18.0) + jwt (3.1.2) base64 kaminari (1.2.2) activesupport (>= 4.1.0) @@ -446,10 +522,11 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - language_server-protocol (3.17.0.3) - launchy (3.0.1) + language_server-protocol (3.17.0.5) + launchy (3.1.1) addressable (~> 2.8) childprocess (~> 5.0) + logger (~> 1.6) letter_opener (1.10.0) launchy (>= 2.2, < 4) letter_opener_web (2.0.0) @@ -457,80 +534,85 @@ GEM letter_opener (~> 1.7) railties (>= 5.2) rexml + lint_roller (1.1.0) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.2) - loofah (2.23.1) + logger (1.7.0) + loofah (2.25.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.8.1) + mail (2.9.0) + logger mini_mime (>= 0.1.1) net-imap net-pop net-smtp - marcel (1.0.4) - matrix (0.4.2) - method_source (1.1.0) - mime-types (3.6.0) + marcel (1.1.0) + matrix (0.4.3) + mime-types (3.7.0) logger - mime-types-data (~> 3.2015) - mime-types-data (3.2024.1203) + mime-types-data (~> 3.2025, >= 3.2025.0507) + mime-types-data (3.2025.0924) mini_magick (4.13.2) mini_mime (1.1.5) - mini_portile2 (2.8.8) - minitest (5.25.4) - msgpack (1.7.5) - multi_xml (0.7.1) - bigdecimal (~> 3.1) - net-http (0.6.0) - uri - net-imap (0.5.1) + minitest (6.0.1) + prism (~> 1.5) + msgpack (1.8.0) + multi_xml (0.8.0) + bigdecimal (>= 3.1, < 5) + net-http (0.9.1) + uri (>= 0.11.1) + net-imap (0.6.2) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.3.4) + net-smtp (0.5.1) net-protocol - nio4r (2.7.4) - nokogiri (1.16.8) - mini_portile2 (~> 2.8.2) + nio4r (2.7.5) + nokogiri (1.19.0-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.8-aarch64-linux) + nokogiri (1.19.0-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.16.8-arm-linux) + nokogiri (1.19.0-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.16.8-arm64-darwin) + nokogiri (1.19.0-arm-linux-musl) racc (~> 1.4) - nokogiri (1.16.8-x86-linux) + nokogiri (1.19.0-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.8-x86_64-darwin) + nokogiri (1.19.0-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.8-x86_64-linux) + nokogiri (1.19.0-x86_64-linux-gnu) racc (~> 1.4) - oauth (1.1.0) - oauth-tty (~> 1.0, >= 1.0.1) + nokogiri (1.19.0-x86_64-linux-musl) + racc (~> 1.4) + oauth (1.1.3) + base64 (~> 0.1) + oauth-tty (~> 1.0, >= 1.0.6) snaky_hash (~> 2.0) - version_gem (~> 1.1) - oauth-tty (1.0.5) - version_gem (~> 1.1, >= 1.1.1) - oauth2 (2.0.9) - faraday (>= 0.17.3, < 3.0) - jwt (>= 1.0, < 3.0) + version_gem (~> 1.1, >= 1.1.9) + oauth-tty (1.0.6) + version_gem (~> 1.1, >= 1.1.9) + oauth2 (2.0.18) + faraday (>= 0.17.3, < 4.0) + jwt (>= 1.0, < 4.0) + logger (~> 1.2) multi_xml (~> 0.5) rack (>= 1.2, < 4) - snaky_hash (~> 2.0) - version_gem (~> 1.1) - omniauth (2.1.2) + snaky_hash (~> 2.0, >= 2.0.3) + version_gem (~> 1.1, >= 1.1.9) + omniauth (2.1.4) hashie (>= 3.4.6) + logger rack (>= 2.2.3) rack-protection omniauth-facebook (5.0.0) omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (1.2.0) - jwt (>= 2.9) + omniauth-google-oauth2 (1.2.1) + jwt (>= 2.9.2) oauth2 (~> 2.0) omniauth (~> 2.0) omniauth-oauth2 (~> 1.8) @@ -538,8 +620,8 @@ GEM oauth omniauth (>= 1.0, < 3) rack (>= 1.6.2, < 4) - omniauth-oauth2 (1.8.0) - oauth2 (>= 1.4, < 3) + omniauth-oauth2 (1.9.0) + oauth2 (>= 2.0.2, < 3) omniauth (~> 2.0) omniauth-rails_csrf_protection (1.0.2) actionpack (>= 4.2) @@ -547,22 +629,27 @@ GEM omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack - openssl (3.2.0) + openssl (4.0.0) orm_adapter (0.5.0) - ostruct (0.6.1) - paper_trail (12.3.0) - activerecord (>= 5.2) - request_store (~> 1.1) - parallel (1.26.3) - parallel_tests (4.7.2) + ostruct (0.6.3) + package_json (0.2.0) + paper_trail (16.0.0) + activerecord (>= 6.1) + request_store (~> 1.4) + parallel (1.27.0) + parallel_tests (4.10.1) parallel - parser (3.3.6.0) + paranoia (3.0.1) + activerecord (>= 6, < 8.1) + parser (3.3.10.0) ast (~> 2.4.1) racc - pg (1.4.6) + pg (1.5.9) pg_search (2.3.7) activerecord (>= 6.1) activesupport (>= 6.1) + pp (0.6.3) + prettyprint premailer (1.27.0) addressable css_parser (>= 1.19.0) @@ -571,14 +658,17 @@ GEM actionmailer (>= 3) net-smtp premailer (~> 1.7, >= 1.7.9) - psych (4.0.6) + prettyprint (0.2.0) + prism (1.7.0) + psych (5.3.1) + date stringio - public_suffix (6.0.1) - puma (6.5.0) + public_suffix (7.0.2) + puma (6.6.1) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.10) - rack-attack (6.7.0) + rack (2.2.21) + rack-attack (6.8.0) rack (>= 1.0, < 4) rack-cors (1.1.1) rack (>= 2.0.0) @@ -587,79 +677,95 @@ GEM rack (~> 2.2, >= 2.2.4) rack-proxy (0.7.7) rack - rack-test (2.1.0) + rack-session (1.0.2) + rack (< 3) + rack-test (2.2.0) rack (>= 1.3) - rails (7.0.8.6) - actioncable (= 7.0.8.6) - actionmailbox (= 7.0.8.6) - actionmailer (= 7.0.8.6) - actionpack (= 7.0.8.6) - actiontext (= 7.0.8.6) - actionview (= 7.0.8.6) - activejob (= 7.0.8.6) - activemodel (= 7.0.8.6) - activerecord (= 7.0.8.6) - activestorage (= 7.0.8.6) - activesupport (= 7.0.8.6) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.2.3) + actioncable (= 7.2.3) + actionmailbox (= 7.2.3) + actionmailer (= 7.2.3) + actionpack (= 7.2.3) + actiontext (= 7.2.3) + actionview (= 7.2.3) + activejob (= 7.2.3) + activemodel (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) bundler (>= 1.15.0) - railties (= 7.0.8.6) + railties (= 7.2.3) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.2.0) + rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.1) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rails-i18n (7.0.10) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.8.6) - actionpack (= 7.0.8.6) - activesupport (= 7.0.8.6) - method_source + railties (7.2.3) + actionpack (= 7.2.3) + activesupport (= 7.2.3) + cgi + irb (~> 1.13) + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.2.1) - ransack (3.2.1) + rake (13.3.1) + ransack (4.2.1) activerecord (>= 6.1.5) activesupport (>= 6.1.5) i18n rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - redcarpet (3.6.0) + rdoc (7.0.3) + erb + psych (>= 4.0.0) + tsort + redcarpet (3.6.1) redis (4.8.1) - regexp_parser (2.9.3) - reline (0.5.12) + regexp_parser (2.11.3) + reline (0.6.3) io-console (~> 0.5) - request_store (1.5.1) + request_store (1.7.0) rack (>= 1.4) - responders (3.1.1) - actionpack (>= 5.2) - railties (>= 5.2) - rexml (3.3.9) - rspec (3.13.0) + responders (3.2.0) + actionpack (>= 7.0) + railties (>= 7.0) + rexml (3.4.4) + rqrcode (2.2.0) + chunky_png (~> 1.0) + rqrcode_core (~> 1.0) + rqrcode_core (1.2.0) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) rspec-cells (0.3.10) cells (>= 4.0.0, < 6.0.0) rspec-rails (>= 3.0.0) - rspec-core (3.13.2) + rspec-core (3.13.6) rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-html-matchers (0.10.0) nokogiri (~> 1) rspec (>= 3.0.0.a) - rspec-mocks (3.13.2) + rspec-mocks (3.13.7) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (6.1.5) @@ -672,61 +778,91 @@ GEM rspec-support (~> 3.13) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.13.2) + rspec-support (3.13.6) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.65.1) + rubocop (1.78.0) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.45.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.36.2) - parser (>= 3.3.1.0) - rubocop-capybara (2.21.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.26.1) - rubocop (~> 1.61) - rubocop-faker (1.2.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.49.0) + parser (>= 3.3.7.2) + prism (~> 1.7) + rubocop-capybara (2.22.1) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-factory_bot (2.27.1) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-faker (1.3.0) faker (>= 2.12.0) - rubocop (>= 1.13.0) - rubocop-performance (1.23.0) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.27.0) + lint_roller (~> 1.1) + rubocop (>= 1.72.1) + rubocop-graphql (1.5.6) + lint_roller (~> 1.1) + rubocop (>= 1.72.1, < 2) + rubocop-performance (1.26.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rails (2.32.0) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.52.0, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (3.2.0) - rubocop (~> 1.61) - rubocop-rspec_rails (2.30.0) - rubocop (~> 1.61) - rubocop-rspec (~> 3, >= 3.0.1) - rubocop-rubycw (0.1.6) - rubocop (~> 1.0) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rspec (3.7.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-rspec_rails (2.31.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-rspec (~> 3.5) + rubocop-rubycw (0.2.2) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) ruby-progressbar (1.13.0) - ruby-vips (2.2.2) + ruby-vips (2.3.0) ffi (~> 1.12) logger - rubyXL (3.4.27) + rubyXL (3.4.33) nokogiri (>= 1.10.8) rubyzip (>= 1.3.0) rubyzip (2.3.2) - selenium-webdriver (4.27.0) + sass-embedded (1.97.1-aarch64-linux-gnu) + google-protobuf (~> 4.31) + sass-embedded (1.97.1-aarch64-linux-musl) + google-protobuf (~> 4.31) + sass-embedded (1.97.1-arm-linux-gnueabihf) + google-protobuf (~> 4.31) + sass-embedded (1.97.1-arm-linux-musleabihf) + google-protobuf (~> 4.31) + sass-embedded (1.97.1-arm64-darwin) + google-protobuf (~> 4.31) + sass-embedded (1.97.1-x86_64-darwin) + google-protobuf (~> 4.31) + sass-embedded (1.97.1-x86_64-linux-gnu) + google-protobuf (~> 4.31) + sass-embedded (1.97.1-x86_64-linux-musl) + google-protobuf (~> 4.31) + securerandom (0.4.1) + selenium-webdriver (4.39.0) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) + rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) semantic_range (3.1.0) - shakapacker (7.1.0) + shakapacker (8.3.0) activesupport (>= 5.2) + package_json rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) @@ -737,34 +873,39 @@ GEM simplecov-cobertura (2.1.0) rexml simplecov (~> 0.19) - simplecov-html (0.13.1) + simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) smart_properties (1.17.0) - snaky_hash (2.0.1) - hashie - version_gem (~> 1.1, >= 1.1.1) - spring (4.2.1) + snaky_hash (2.0.3) + hashie (>= 0.1.0, < 6) + version_gem (>= 1.1.8, < 3) + spring (4.4.0) spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) spring (>= 4) - stringio (3.1.2) - temple (0.10.3) - terminal-table (3.0.2) - unicode-display_width (>= 1.1.1, < 3) - thor (1.3.2) - tilt (2.4.0) - timeout (0.4.2) + stringio (3.2.0) + strscan (3.1.6) + temple (0.10.4) + terminal-table (4.0.0) + unicode-display_width (>= 1.1.1, < 4) + thor (1.4.0) + tilt (2.6.1) + timeout (0.6.0) trailblazer-option (0.1.2) + tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) - unicode-display_width (2.6.0) - uniform_notifier (1.16.0) - uri (1.0.2) - valid_email2 (4.0.6) - activemodel (>= 3.2) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) + uniform_notifier (1.18.0) + uri (1.1.1) + useragent (0.16.11) + valid_email2 (7.0.13) + activemodel (>= 6.0) mail (~> 2.5) - version_gem (1.1.4) + version_gem (1.1.9) w3c_rspec_validators (0.3.0) rails rspec @@ -775,55 +916,53 @@ GEM rexml (~> 3.2) warden (1.2.9) rack (>= 2.0.9) + warden-jwt_auth (0.12.0) + dry-auto_inject (>= 0.8, < 2) + dry-configurable (>= 0.13, < 2) + jwt (>= 2.1, < 4) + warden (~> 1.2) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - web-push (3.0.1) - jwt (~> 2.0) - openssl (~> 3.0) - webmock (3.24.0) + web-push (3.1.0) + jwt (~> 3.0) + openssl (>= 3.0) + webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.2) websocket (1.2.11) - websocket-driver (0.7.6) + websocket-driver (0.8.0) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - wicked_pdf (2.8.2) - activesupport - ostruct - wisper (2.0.1) + wisper (3.0.0) wisper-rspec (1.1.0) - wkhtmltopdf-binary (0.12.6.6) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.7.1) + zeitwerk (2.7.4) PLATFORMS - aarch64-linux aarch64-linux-gnu aarch64-linux-musl - arm-linux arm-linux-gnu + arm-linux-gnueabihf arm-linux-musl + arm-linux-musleabihf arm64-darwin - ruby - x86-linux - x86-linux-gnu - x86-linux-musl x86_64-darwin - x86_64-linux x86_64-linux-gnu x86_64-linux-musl DEPENDENCIES bootsnap (~> 1.4) byebug (~> 11.0) - decidim (~> 0.29.1) + decidim (~> 0.31.0) decidim-additional_authorization_handler! - decidim-dev (~> 0.29.1) + decidim-dev (~> 0.31.0) faker (~> 3.2) letter_opener_web (~> 2.0) listen (~> 3.1) @@ -831,7 +970,7 @@ DEPENDENCIES web-console (~> 4.2) RUBY VERSION - ruby 3.2.2p53 + ruby 3.3.4p94 BUNDLED WITH - 2.5.22 + 2.5.11 diff --git a/app/jobs/decidim/export_job.rb b/app/jobs/decidim/export_job.rb index fe75a21..e478a4d 100644 --- a/app/jobs/decidim/export_job.rb +++ b/app/jobs/decidim/export_job.rb @@ -2,6 +2,8 @@ module Decidim class ExportJob < ApplicationJob + include Decidim::PrivateDownloadHelper + queue_as :exports # rubocop:disable Metrics/ParameterLists @@ -19,8 +21,8 @@ def perform(user, component, name, format, resource_id = nil, filters = nil) else Decidim::Exporters.find_exporter(format).new(collection, serializer).export end - - ExportMailer.export(user, name, export_data).deliver_now + private_export = attach_archive(export_data, name, user) + ExportMailer.export(user, private_export).deliver_now end # rubocop:enable Metrics/ParameterLists end diff --git a/app/packs/stylesheets/decidim/additional_authorization_handler/additional_authorization_handler.scss b/app/packs/stylesheets/decidim/additional_authorization_handler/additional_authorization_handler.scss index 0308b4b..a3af127 100644 --- a/app/packs/stylesheets/decidim/additional_authorization_handler/additional_authorization_handler.scss +++ b/app/packs/stylesheets/decidim/additional_authorization_handler/additional_authorization_handler.scss @@ -20,6 +20,18 @@ width: 60%; margin-bottom: 1rem; } + label[for=authorization_handler_first_name] input { + display: block; + margin: 1rem 0; + } + label[for=authorization_handler_last_name] input { + display: block; + margin: 1rem 0; + } + label[for=authorization_handler_postal_code] input { + display: block; + margin: 1rem 0; + } label[for=authorization_handler_address] input { display: block; margin: 1rem 0; diff --git a/app/views/extended_socio_demographic_authorization/_form.html.erb b/app/views/extended_socio_demographic_authorization/_form.html.erb index 18164ad..85ba3d9 100644 --- a/app/views/extended_socio_demographic_authorization/_form.html.erb +++ b/app/views/extended_socio_demographic_authorization/_form.html.erb @@ -60,7 +60,7 @@ -
+
<%= I18n.t('decidim.authorization_handlers.extended_socio_demographic_authorization_handler.help_text.global_help_html')%>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 20dcd2b..21b8200 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -24,7 +24,7 @@ en: resident: Resident rgpd: Rgpd help_text: - global_help_html: It is necessary to complete this form to create an initiative. + global_help_html: It is necessary to complete this form to be authorized to perform this action. name: Additional informations components: additionals_authorization_handler: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 368ee73..cabe8ac 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -23,7 +23,7 @@ fr: resident: J'atteste avoir plus de 16 ans et résider, travailler ou étudier dans le département de Loire-Atlantique. rgpd: rgpd help_text: - global_help_html: Il est nécessaire de compléter ce formulaire pour créer une initiative. + global_help_html: Il est nécessaire de remplir ce formulaire pour être autorisé à effectuer cette action. name: Données personnelles verifications: authorizations: diff --git a/decidim-additional_authorization_handler.gemspec b/decidim-additional_authorization_handler.gemspec index 83b0082..f454334 100644 --- a/decidim-additional_authorization_handler.gemspec +++ b/decidim-additional_authorization_handler.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| "homepage_uri" => "https://decidim.org", "source_code_uri" => "https://github.com/decidim/decidim" } - s.required_ruby_version = "~> 3.2" + s.required_ruby_version = "~> 3.3" s.name = "decidim-additional_authorization_handler" s.summary = "A decidim additional_authorization_handler module" diff --git a/lib/decidim/additional_authorization_handler/extends/proposal_serializer_extend.rb b/lib/decidim/additional_authorization_handler/extends/proposal_serializer_extend.rb index f2e4f2e..4386235 100644 --- a/lib/decidim/additional_authorization_handler/extends/proposal_serializer_extend.rb +++ b/lib/decidim/additional_authorization_handler/extends/proposal_serializer_extend.rb @@ -14,14 +14,7 @@ def initialize(proposal, public_scope: true) def serialize { id: proposal.id, - category: { - id: proposal.category.try(:id), - name: proposal.category.try(:name) || empty_translatable - }, - scope: { - id: proposal.scope.try(:id), - name: proposal.scope.try(:name) || empty_translatable - }, + taxonomies:, participatory_space: { id: proposal.participatory_space.id, url: Decidim::ResourceLocatorPresenter.new(proposal.participatory_space).url @@ -33,17 +26,19 @@ def serialize latitude: proposal.latitude, longitude: proposal.longitude, state: proposal.state.to_s, + state_published_at: proposal.state_published_at, reference: proposal.reference, answer: ensure_translatable(proposal.answer), answered_at: proposal.answered_at, - votes: proposal.proposal_votes_count, - endorsements: { - total_count: proposal.endorsements.size, - user_endorsements: + votes: (proposal.proposal_votes_count unless + proposal.component.current_settings.votes_hidden?), + likes: { + total_count: proposal.likes.size, + user_likes: }, comments: proposal.comments_count, attachments: proposal.attachments.size, - followers: proposal.follows.size, + follows_count: proposal.follows_count, published_at: proposal.published_at, url:, meeting_urls: meetings, @@ -54,7 +49,14 @@ def serialize url: original_proposal_url }, withdrawn: proposal.withdrawn?, - withdrawn_at: proposal.withdrawn_at + withdrawn_at: proposal.withdrawn_at, + created_at: proposal.created_at, + updated_at: proposal.updated_at, + created_in_meeting: proposal.created_in_meeting, + coauthorships_count: proposal.coauthorships_count, + cost: proposal.cost, + cost_report: proposal.cost_report, + execution_period: proposal.execution_period }.merge(options_merge(author: { **author_fields })) @@ -69,35 +71,91 @@ def options_merge(options_object) private - def author_fields - is_author_user_group = resource.coauthorships.map(&:decidim_user_group_id).any? + attr_reader :proposal + alias resource proposal + + def meetings + proposal.linked_resources(:meetings, "proposals_from_meeting").map do |meeting| + Decidim::ResourceLocatorPresenter.new(meeting).url + end + end + + def related_proposals + proposal.linked_resources(:proposals, %w(copied_from_component merged_from_component splitted_from_component)).map do |proposal| + Decidim::ResourceLocatorPresenter.new(proposal).url + end + end + + def url + Decidim::ResourceLocatorPresenter.new(proposal).url + end + + def user_likes + proposal.likes.for_listing.map { |identity| identity.author&.name } + end + + def original_proposal_url + return unless proposal.emendation? && proposal.amendable.present? + + Decidim::ResourceLocatorPresenter.new(proposal.amendable).url + end + + # Recursively strips HTML tags from given Hash strings using convert_to_text from Premailer + def convert_to_plain_text(value) + return value.transform_values { |v| convert_to_plain_text(v) } if value.is_a?(Hash) + + convert_to_text(value) + end + def author_fields { id: resource.authors.map(&:id), name: resource.authors.map do |author| - author_name(is_author_user_group ? resource.coauthorships.first.user_group : author) + author_name(author) end, url: resource.authors.map do |author| - author_url(is_author_user_group ? resource.coauthorships.first.user_group : author) + author_url(author) end - }.merge(additional_fields(is_author_user_group)) + }.merge(additional_fields) + end + + def author_name(author) + if author.respond_to?(:name) + translated_attribute(author.name) # is a Decidim::User or Decidim::Organization + elsif author.respond_to?(:title) + translated_attribute(author.title) # is a Decidim::Meetings::Meeting + end + end + + def author_url(author) + if author.respond_to?(:nickname) + profile_url(author) # is a Decidim::User + elsif author.respond_to?(:title) + meeting_url(author) # is a Decidim::Meetings::Meeting + else + root_url # is a Decidim::Organization + end + end + + def meeting_url(meeting) + Decidim::EngineRouter.main_proxy(meeting.component).meeting_url(id: meeting.id, host:) end - def additional_fields(is_author_user_group) + def additional_fields { nickname: resource.authors.map do |author| - author_nickname(is_author_user_group ? resource.coauthorships.first.user_group : author) + author_nickname(author) end, email: resource.authors.map do |author| - author_email(is_author_user_group ? resource.coauthorships.first.user_group : author) + author_email(author) end, - phone_number: author_phone_number(resource.authors.map { |author| is_author_user_group ? "" : author.id }) + phone_number: author_phone_number(resource.authors.map(&:id)) } end def author_nickname(author) if author.respond_to?(:nickname) - translated_attribute(author.nickname) # is a Decidim::User or Decidim::Organization or Decidim::UserGroup + translated_attribute(author.nickname) else "" end @@ -105,13 +163,13 @@ def author_nickname(author) def author_email(author) if author.respond_to?(:email) - translated_attribute(author.email) # is a Decidim::User or Decidim::Organization or Decidim::UserGroup + translated_attribute(author.email) else "" end end - # author_phone_number retrieve the phone number of an user stored from phone_authorization_handler + # author_phone_number retrieve the phone number of a user stored from phone_authorization_handler # Param: user_id : Integer # Return string, empty or with the phone number def author_phone_number(user_id) diff --git a/lib/decidim/additional_authorization_handler/version.rb b/lib/decidim/additional_authorization_handler/version.rb index f953cae..e535ba7 100644 --- a/lib/decidim/additional_authorization_handler/version.rb +++ b/lib/decidim/additional_authorization_handler/version.rb @@ -4,11 +4,11 @@ module Decidim # This holds the decidim-meetings version. module AdditionalAuthorizationHandler def self.decidim_version - "~> 0.29.0" + "~> 0.31.0" end def self.version - "1.0.0" + "1.1.0" end end end diff --git a/spec/jobs/export_job_spec.rb b/spec/jobs/export_job_spec.rb index b5599cb..d19524d 100644 --- a/spec/jobs/export_job_spec.rb +++ b/spec/jobs/export_job_spec.rb @@ -10,27 +10,23 @@ module Admin let!(:user) { create(:user, organization:) } it "sends an email with the result of the export" do - ExportJob.perform_now(user, component, "dummies", "CSV") + perform_enqueued_jobs { ExportJob.perform_now(user, component, "dummies", "CSV") } email = last_email expect(email.subject).to include("dummies") - attachment = email.attachments.first - - expect(attachment.read.length).to be_positive - expect(attachment.mime_type).to eq("application/zip") - expect(attachment.filename).to match(/^dummies-[0-9]+-[0-9]+-[0-9]+-[0-9]+\.zip$/) + expect(last_email_body).to include("Your download is ready.") end describe "CSV" do it "uses the CSV exporter" do - export_data = double + export_data = double(read: "", filename: "dummies") expect(Decidim::Exporters::CSV) .to(receive(:new).with(anything, Decidim::Dev::DummySerializer)) .and_return(double(export: export_data)) expect(ExportMailer) - .to(receive(:export).with(user, anything, export_data)) + .to(receive(:export).with(user, kind_of(Decidim::PrivateExport))) .and_return(double(deliver_now: true)) ExportJob.perform_now(user, component, "dummies", "CSV") @@ -39,14 +35,14 @@ module Admin describe "JSON" do it "uses the JSON exporter" do - export_data = double + export_data = double(read: "", filename: "dummies") expect(Decidim::Exporters::JSON) .to(receive(:new).with(anything, Decidim::Dev::DummySerializer)) .and_return(double(export: export_data)) expect(ExportMailer) - .to(receive(:export).with(user, anything, export_data)) + .to(receive(:export).with(user, kind_of(Decidim::PrivateExport))) .and_return(double(deliver_now: true)) ExportJob.perform_now(user, component, "dummies", "JSON") @@ -55,14 +51,14 @@ module Admin describe "Excel" do it "uses the Excel exporter" do - export_data = double + export_data = double(read: "", filename: "dummies") expect(Decidim::Exporters::Excel) .to(receive(:new).with(anything, Decidim::Dev::DummySerializer)) .and_return(double(export: export_data)) expect(ExportMailer) - .to(receive(:export).with(user, anything, export_data)) + .to(receive(:export).with(user, kind_of(Decidim::PrivateExport))) .and_return(double(deliver_now: true)) ExportJob.perform_now(user, component, "dummies", "Excel") diff --git a/spec/lib/decidim/additional_authorization_handler/version_spec.rb b/spec/lib/decidim/additional_authorization_handler/version_spec.rb index a0cbcc6..6684d77 100644 --- a/spec/lib/decidim/additional_authorization_handler/version_spec.rb +++ b/spec/lib/decidim/additional_authorization_handler/version_spec.rb @@ -7,11 +7,11 @@ module Decidim subject { described_class } it "returns decidim version" do - expect(subject.decidim_version).to eq("~> 0.29.0") + expect(subject.decidim_version).to eq("~> 0.31.0") end it "returns module's version" do - expect(described_class.version).to eq("1.0.0") + expect(described_class.version).to eq("1.1.0") end end end diff --git a/spec/permissions/admin/permissions_spec.rb b/spec/permissions/admin/permissions_spec.rb index 3253647..a5970a3 100644 --- a/spec/permissions/admin/permissions_spec.rb +++ b/spec/permissions/admin/permissions_spec.rb @@ -6,7 +6,7 @@ module Decidim::AdditionalAuthorizationHandler::Admin describe Permissions do subject { described_class.new(user, permission_action, context).permissions.allowed? } - let(:organization) { create :organization } + let(:organization) { create(:organization) } let(:context) do { current_organization: organization @@ -18,7 +18,7 @@ module Decidim::AdditionalAuthorizationHandler::Admin let(:permission_action) { Decidim::PermissionAction.new(**action) } context "when user is admin" do - let(:user) { create :user, :admin, organization: } + let(:user) { create(:user, :admin, organization:) } it { is_expected.to be_truthy } @@ -32,7 +32,7 @@ module Decidim::AdditionalAuthorizationHandler::Admin end context "when user is not admin" do - let(:user) { create :user, organization: } + let(:user) { create(:user, organization:) } it_behaves_like "permission is not set" end diff --git a/spec/services/proposals/proposal_serializer_spec.rb b/spec/services/proposals/proposal_serializer_spec.rb index 78608e1..982478f 100644 --- a/spec/services/proposals/proposal_serializer_spec.rb +++ b/spec/services/proposals/proposal_serializer_spec.rb @@ -9,18 +9,22 @@ module Proposals described_class.new(proposal) end + let!(:body) { { en: ::Faker::Lorem.sentence } } let!(:proposal) { create(:proposal, :accepted, body:) } - let!(:category) { create(:category, participatory_space: component.participatory_space) } - let!(:scope) { create(:scope, organization: component.participatory_space.organization) } + let!(:taxonomies) { create_list(:taxonomy, 2, :with_parent, organization: component.organization) } let(:participatory_process) { component.participatory_space } let(:component) { proposal.component } let!(:meetings_component) { create(:component, manifest_name: "meetings", participatory_space: participatory_process) } let(:meetings) { create_list(:meeting, 2, :published, component: meetings_component) } - let!(:proposals_component) { create(:component, manifest_name: "proposals", participatory_space: participatory_process) } + let!(:proposals_component) { create(:proposal_component, participatory_space: participatory_process) } let(:other_proposals) { create_list(:proposal, 2, component: proposals_component) } - let(:body) { Decidim::Faker::Localized.localized { ::Faker::Lorem.sentences(number: 3).join("\n") } } + + let(:serialized) { subject.serialize } + let(:serialized_taxonomies) do + { ids: taxonomies.pluck(:id) }.merge(taxonomies.to_h { |t| [t.id, t.name] }) + end let(:expected_answer) do answer = proposal.answer @@ -34,8 +38,7 @@ module Proposals end before do - proposal.update!(category:) - proposal.update!(scope:) + proposal.update!(taxonomies:) proposal.link_resources(meetings, "proposals_from_meeting") proposal.link_resources(other_proposals, "copied_from_component") end @@ -43,22 +46,16 @@ module Proposals describe "#serialize" do let(:serialized) { subject.serialize } - it "doesn't serialize author's data" do - expect(serialized).not_to include(:author) - end - it "serializes the id" do expect(serialized).to include(id: proposal.id) end - it "serializes the category" do - expect(serialized[:category]).to include(id: category.id) - expect(serialized[:category]).to include(name: category.name) + it "serializes the taxonomies" do + expect(serialized[:taxonomies]).to eq(serialized_taxonomies) end - it "serializes the scope" do - expect(serialized[:scope]).to include(id: scope.id) - expect(serialized[:scope]).to include(name: scope.name) + it "doesn't serialize author's data" do + expect(serialized).not_to include(:author) end it "serializes the title" do @@ -139,9 +136,21 @@ module Proposals expect(serialized).to include(attachments: proposal.attachments.count) end - it "serializes the endorsements" do - expect(serialized[:endorsements]).to include(total_count: proposal.endorsements.count) - expect(serialized[:endorsements]).to include(user_endorsements: proposal.endorsements.for_listing.map { |identity| identity.normalized_author&.name }) + it "serializes the state at which the proposal was published at" do + expect(serialized).to include(state_published_at: proposal.state_published_at) + end + + it "serializes the how many co-authorships exist" do + expect(serialized).to include(coauthorships_count: proposal.coauthorships_count) + end + + it "serializes the number of followers of the proposal" do + expect(serialized).to include(follows_count: proposal.follows_count) + end + + it "serializes the likes" do + expect(serialized[:likes]).to include(total_count: proposal.likes.count) + expect(serialized[:likes]).to include(user_likes: proposal.likes.for_listing.map { |identity| identity.author&.name }) end it "serializes related proposals" do @@ -158,6 +167,62 @@ module Proposals expect(serialized[:original_proposal][:url]).to be_nil || include("http", proposal.id.to_s) end + it "serialize the created at date" do + expect(serialized).to include(created_at: proposal.created_at) + end + + it "serialize the updated at date" do + expect(serialized).to include(updated_at: proposal.updated_at) + end + + it "serializes whether the proposal was created in a meeting" do + expect(serialized).to include(created_in_meeting: proposal.created_in_meeting) + end + + it "serializes the cost of the proposal" do + expect(serialized).to include(cost: proposal.cost) + end + + it "serializes the execution period of the proposal" do + expect(serialized).to include(execution_period: proposal.execution_period) + end + + # This is an internal field for admins which should not be published + context "when proposal notes count are hidden" do + it "does not publish them" do + expect(serialized).not_to include(proposal_notes_count: proposal.proposal_notes_count) + end + end + + # This is an internal field for admins which should not be published + context "when evaluation assignments are hidden" do + it "does not publish them" do + expect(serialized).not_to include(evaluation_assignments_count: proposal.evaluation_assignments_count) + end + end + + context "when proposals with costs that are not published" do + let!(:proposal) { create(:proposal, :with_answer) } + let(:cost) { proposal.cost } + let(:cost_report) { proposal.cost_report } + let(:execution_period) { proposal.execution_period } + let(:answer) { proposal.answer } + + before do + proposal.update!(cost: nil, cost_report: nil, execution_period: nil, answer: nil, state_published_at: nil) + end + + it "includes costs with a proposal not published" do + expect(serialized).to include( + cost: nil, + cost_report: nil, + execution_period: nil, + answer: expected_answer, + state_published_at: nil + ) + end + end + context "with proposal having an answer" do let!(:proposal) { create(:proposal, :with_answer) } @@ -166,6 +231,46 @@ module Proposals end end + context "when the proposal is answered but not published" do + before do + proposal.update!(answered_at:, state_published_at: nil) + end + + let(:answered_at) { Time.current } + + it "includes the answered_at timestamp and leaves state_published_at nil" do + expect(serialized).to include( + answered_at:, + state_published_at: nil + ) + end + end + + context "when the proposal is answered and published" do + before do + proposal.update!(answered_at:, state_published_at:) + end + + let(:answered_at) { Time.current } + let(:state_published_at) { answered_at + 1.day } + + it "includes both answered_at and state_published_at timestamps" do + expect(serialized).to include( + answered_at:, + state_published_at: + ) + end + end + + context "when the votes are hidden" do + let!(:component) { create(:proposal_component, :with_votes_hidden) } + let!(:proposal) { create(:proposal, component:) } + + it "does not include total count of votes" do + expect(serialized).to include(votes: nil) + end + end + context "with rich text proposal body" do let(:image) { "" } let(:alt_attribute) { "alt=\"Logo alt attribute\"" } @@ -304,7 +409,7 @@ module Proposals end before do - proposal.creator_author.update!(name: "John Doe", nickname: "JohnDoe") + proposal.creator_author.update!(name: "John Doe", nickname: "john-doe") proposal.reload end @@ -313,7 +418,7 @@ module Proposals end it "serializes the user nickname" do - expect(serialized[:author]).to include(nickname: ["JohnDoe"]) + expect(serialized[:author]).to include(nickname: ["john-doe"]) end it "serializes the user email" do @@ -355,40 +460,11 @@ module Proposals expect(serialized[:author]).to include(url: urls) end end - - context "when it is a user group" do - let!(:proposal) { create(:proposal, :user_group_author) } - - before do - proposal.coauthorships.first.user_group.update!(name: "ACME", nickname: "acme") - proposal.reload - end - - it "serializes author" do - expect(serialized).to include(:author) - end - - it "serializes the user name of the user group" do - expect(serialized[:author]).to include(name: ["ACME"]) - end - - it "serializes the link to the profile of the user group" do - expect(serialized[:author]).to include(url: [profile_url("acme")]) - end - - it "serializes the nickname of the user group" do - expect(serialized[:author]).to include(nickname: ["acme"]) - end - - it "serializes the email of the user group" do - expect(serialized[:author]).to include(email: [proposal.coauthorships.first.user_group.email.to_s]) - end - end end end def profile_url(nickname) - Decidim::Core::Engine.routes.url_helpers.profile_url(nickname, host:) + Decidim::Core::Engine.routes.url_helpers.profile_url(nickname, host:, port: Capybara.server_port) end def meeting_url(meeting) diff --git a/spec/system/extended_socio_demographic_authorization_handler/authentication_spec.rb b/spec/system/extended_socio_demographic_authorization_handler/authentication_spec.rb index e58f500..7e1e16c 100644 --- a/spec/system/extended_socio_demographic_authorization_handler/authentication_spec.rb +++ b/spec/system/extended_socio_demographic_authorization_handler/authentication_spec.rb @@ -5,8 +5,31 @@ describe "Authentication" do let(:organization) { create(:organization) } let(:last_user) { Decidim::User.last } + let(:omniauth_secrets) do + { + facebook: { + enabled: true, + app_id: "fake-facebook-app-id", + app_secret: "fake-facebook-app-secret", + icon: "phone" + }, + twitter: { + enabled: true, + api_key: "fake-twitter-api-key", + api_secret: "fake-twitter-api-secret", + icon: "phone" + }, + google_oauth2: { + enabled: true, + client_id: nil, + client_secret: nil, + icon: "phone" + } + } + end before do + allow(Decidim).to receive(:omniauth_providers).and_return(omniauth_secrets) switch_to_host(organization.host) visit decidim.root_path end @@ -18,7 +41,7 @@ context "when using email and password" do it "creates a new User" do - click_on("Create an account") + click_on "Create an account" within ".new_user" do fill_in :registration_user_email, with: "user@example.org" @@ -59,7 +82,7 @@ context "when being a robot" do it "denies the sign up" do - click_on("Create an account") + click_on "Create an account" within ".new_user" do page.execute_script("$($('.new_user > div > input')[0]).val('Ima robot :D')") @@ -82,6 +105,7 @@ uid: "123545", info: { email: "user@from-facebook.com", + nickname: "facebook_user", name: "Facebook User" } ) @@ -102,20 +126,33 @@ context "when the user has confirmed the email in facebook" do it "creates a new User without sending confirmation instructions" do - click_on("Create an account") + click_on "Create an account" - find(".login__omniauth-button.button--facebook").click + find(".login__omniauth-button.login__omniauth-button--facebook").click + + check :registration_user_tos_agreement + within "#omniauth-register-form" do + click_on "Create an account" + end + sleep 5 + click_on("Keep unchecked") expect(page).to have_content("Successfully") expect_user_logged + expect(Decidim::Identity.where(provider: :facebook, uid: "123545").first.user.newsletter_notifications_at).not_to be_present end end it "sends a welcome notification" do - click_on("Create an account") + click_on "Create an account" - find(".login__omniauth-button.button--facebook").click - click_on "I agree with these terms" + find(".login__omniauth-button.login__omniauth-button--facebook").click + + check :registration_user_tos_agreement + check :registration_user_newsletter + within "#omniauth-register-form" do + click_on "Create an account" + end within_user_menu do click_on "Notifications" @@ -127,6 +164,37 @@ expect(last_email_body).to include("thanks for joining #{translated(organization.name)}") end + + context "when user did not fill one of the fields" do + let(:omniauth_hash) do + OmniAuth::AuthHash.new( + provider: "facebook", + uid: "123545", + info: { + nickname: "facebook_user", + name: "Facebook User" + } + ) + end + + it "has to complete the account profile" do + within "#main-bar" do + click_on("Log in") + end + + find(".login__omniauth-button.login__omniauth-button--facebook").click + expect(page).to have_content("Please complete your profile") + expect(page).to have_content("cannot be blank") + + fill_in "Your email", with: "user@from-developer.com" + page.find_by_id("registration_user_tos_agreement").check + page.find_by_id("registration_user_newsletter").check + click_on "Complete profile" + + expect(page).to have_content("A message with a confirmation link has been sent to your email address. Please follow the link to activate your account.") + expect(Decidim::Identity.where(provider: :facebook, uid: "123545").first.user.newsletter_notifications_at).to be_present + end + end end context "when using twitter" do @@ -159,9 +227,9 @@ context "when the response does not include the email" do it "redirects the user to a finish signup page" do - click_on("Create an account") + click_on "Create an account" - find(".button--x").click + find(".login__omniauth-button--x").click expect(page).to have_content("Successfully") expect(page).to have_content("Please complete your profile") @@ -176,15 +244,17 @@ context "and a user already exists with the given email" do it "does not allow it" do create(:user, :confirmed, email: "user@from-twitter.com", organization:) - click_on("Create an account") + click_on "Create an account" - find(".button--x").click + find(".login__omniauth-button--x").click expect(page).to have_content("Successfully") expect(page).to have_content("Please complete your profile") within ".new_user" do fill_in :registration_user_email, with: "user@from-twitter.com" + check :registration_user_tos_agreement + check :registration_user_newsletter find("*[type=submit]").click end @@ -198,17 +268,26 @@ let(:email) { "user@from-twitter.com" } it "creates a new User" do - click_on("Create an account") - find(".login__omniauth-button.button--x").click + click_on "Create an account" + find(".login__omniauth-button.login__omniauth-button--x").click + + check :registration_user_tos_agreement + check :registration_user_newsletter + within "#omniauth-register-form" do + click_on "Create an account" + end expect_user_logged end it "sends a welcome notification" do - click_on("Create an account") - find(".login__omniauth-button.button--x").click - - click_on "I agree with these terms" + click_on "Create an account" + find(".login__omniauth-button.login__omniauth-button--x").click + check :registration_user_tos_agreement + check :registration_user_newsletter + within "#omniauth-register-form" do + click_on "Create an account" + end within_user_menu do click_on "Notifications" @@ -230,6 +309,7 @@ uid: "123545", info: { name: "Google User", + nickname: "google_user", email: "user@from-google.com" } ) @@ -250,19 +330,27 @@ end it "creates a new User" do - click_on("Create an account") + click_on "Create an account" click_on "Log in with Google" + check :registration_user_tos_agreement + check :registration_user_newsletter + within "#omniauth-register-form" do + click_on "Create an account" + end expect_user_logged end it "sends a welcome notification" do - click_on("Create an account") + click_on "Create an account" click_on "Log in with Google" - - click_on "I agree with these terms" + check :registration_user_tos_agreement + check :registration_user_newsletter + within "#omniauth-register-form" do + click_on "Create an account" + end within_user_menu do click_on "Notifications" @@ -276,11 +364,11 @@ end end - context "when nickname is not unique case-insensitively" do - let!(:user) { create(:user, nickname: "Responsible_Citizen", organization:) } + context "when nickname is not unique" do + let!(:user) { create(:user, nickname: "responsible_citizen", organization:) } it "creates a new User" do - click_on("Create an account") + click_on "Create an account" within ".new_user" do fill_in :registration_user_email, with: "user@example.org" @@ -334,6 +422,8 @@ perform_enqueued_jobs { user.confirm } switch_to_host(user.organization.host) login_as user, scope: :user + # Prevent flaky spec where user is not logged in + sleep 1 visit decidim.root_path end @@ -362,7 +452,7 @@ fill_in :confirmation_user_email, with: user.email perform_enqueued_jobs { find("*[type=submit]").click } end - + sleep 5 expect(emails.count).to eq(2) expect(page).to have_content("receive an email with instructions") end @@ -512,6 +602,8 @@ describe "Log Out" do before do login_as user, scope: :user + # Prevent flaky spec where user is not logged in + sleep 1 visit decidim.root_path end @@ -596,6 +688,7 @@ end expect(page).to have_content("If your account exists") + sleep 5 expect(emails.count).to eq(1) end @@ -657,7 +750,7 @@ it "authenticates an existing User" do click_on("Log in", match: :first) - find(".login__omniauth-button.button--facebook").click + find(".login__omniauth-button.login__omniauth-button--facebook").click expect(page).to have_content("Successfully") expect_current_user_to_be(user) @@ -691,7 +784,7 @@ it "authenticates an existing User" do click_on("Log in", match: :first) - find(".login__omniauth-button.button--facebook").click + find(".login__omniauth-button.login__omniauth-button--facebook").click expect(page).to have_content("Successfully") expect_current_user_to_be(user) @@ -720,7 +813,7 @@ describe "Create an account" do context "when using the same email" do it "creates a new User" do - click_on("Create an account") + click_on "Create an account" within ".new_user" do fill_in :registration_user_email, with: user.email @@ -748,6 +841,7 @@ info: { email: user.email, name: "Facebook User", + nickname: "facebook_user", verified: true } ) @@ -769,11 +863,17 @@ describe "Create an account" do context "when the user has confirmed the email in facebook" do it "creates a new User without sending confirmation instructions" do - click_on("Create an account") + click_on "Create an account" - find(".login__omniauth-button.button--facebook").click + find(".login__omniauth-button.login__omniauth-button--facebook").click - expect(page).to have_content("Successfully") + expect(page).to have_content("Finish creating your account") + + check :registration_user_tos_agreement + check :registration_user_newsletter + within "#omniauth-register-form" do + click_on "Create an account" + end expect_user_logged end end diff --git a/spec/system/extended_socio_demographic_authorization_handler/authorizations_spec.rb b/spec/system/extended_socio_demographic_authorization_handler/authorizations_spec.rb index c9daf33..605c814 100644 --- a/spec/system/extended_socio_demographic_authorization_handler/authorizations_spec.rb +++ b/spec/system/extended_socio_demographic_authorization_handler/authorizations_spec.rb @@ -2,33 +2,32 @@ require "spec_helper" -describe "Authorizations", with_authorization_workflows: ["dummy_authorization_handler"] do +describe "Authorizations", with_authorization_workflows: %w(dummy_authorization_handler another_dummy_authorization_handler) do before do switch_to_host(organization.host) end - context "when a new user" do + context "when a new user visits authorizations" do let(:organization) { create(:organization, available_authorizations: authorizations) } let(:user) { create(:user, :confirmed, organization:) } context "when one authorization has been configured" do - let(:authorizations) { ["dummy_authorization_handler"] } + let(:authorizations) { %w(dummy_authorization_handler another_dummy_authorization_handler) } + let!(:homepage_content_block) { create(:content_block, organization:, scope_name: :homepage, manifest_name: :how_to_participate) } before do - visit decidim.root_path - within "#main-bar" do - click_on("Log in") - end + sign_in + visit_authorizations + end - within "form.new_user", match: :first do - fill_in :session_user_email, with: user.email - fill_in :session_user_password, with: "decidim123456789" - find("*[type=submit]").click - end + it "shows one authorization link" do + expect(page).to have_css("a[data-verification]", text: "Example authorization") end - it "redirects the user to the authorization form after the first sign in" do + it "allows the user to fill in the authorization form" do + click_on "Example authorization" + fill_in "Document number", with: "123456789X" fill_in_datepicker :authorization_handler_birthday_date, with: Time.current.change(day: 12).strftime("%d/%m/%Y") @@ -38,10 +37,12 @@ end it "allows the user to skip it" do - click_on "consult the content of the platform" - expect(page).to have_current_path decidim.account_path + click_on "Example authorization" + + click_link_or_button "consult the content of the platform" + expect(page).to have_current_path decidim.root_path - expect(page).to have_content("Participant settings") + expect(page).to have_content("How do I take part in a process?") end context "and a duplicate authorization exists for an existing user" do @@ -50,6 +51,8 @@ let!(:other_user) { create(:user, :confirmed, organization: user.organization) } it "transfers the authorization from the deleted user" do + click_on "Example authorization" + fill_in "Document number", with: document_number fill_in_datepicker :authorization_handler_birthday_date, with: Time.current.change(day: 12).strftime("%d/%m/%Y") @@ -69,6 +72,8 @@ let!(:other_user) { create(:user, :deleted, organization: user.organization) } it "transfers the authorization from the deleted user" do + click_on "Example authorization" + fill_in "Document number", with: document_number fill_in_datepicker :authorization_handler_birthday_date, with: Time.current.change(day: 12).strftime("%d/%m/%Y") @@ -110,24 +115,16 @@ end end - context "when multiple authorizations have been configured", with_authorization_workflows: %w(dummy_authorization_handler dummy_authorization_workflow) do - let(:authorizations) { %w(dummy_authorization_handler dummy_authorization_workflow) } + context "when multiple authorizations have been configured", with_authorization_workflows: %w(dummy_authorization_handler another_dummy_authorization_handler) do + let(:authorizations) { %w(dummy_authorization_handler another_dummy_authorization_handler) } before do - visit decidim.root_path - within "#main-bar" do - click_on("Log in") - end - - within "form.new_user", match: :first do - fill_in :session_user_email, with: user.email - fill_in :session_user_password, with: "decidim123456789" - find("*[type=submit]").click - end + sign_in + visit_authorizations end it "allows the user to choose which one to authorize against to" do - expect(page).to have_css("a[href]", text: /\AVerify against /, count: 2) + expect(page).to have_css("a[data-verification]", count: 2) end end end @@ -142,7 +139,7 @@ end context "when user has not already been authorized" do - let(:authorizations) { ["dummy_authorization_handler"] } + let(:authorizations) { %w(dummy_authorization_handler another_dummy_authorization_handler) } it "allows the user to authorize against available authorizations" do visit_authorizations @@ -177,7 +174,7 @@ end context "when the user has already been authorized" do - let(:authorizations) { ["dummy_authorization_handler"] } + let(:authorizations) { %w(dummy_authorization_handler another_dummy_authorization_handler) } let!(:authorization) do create(:authorization, name: "dummy_authorization_handler", user:) @@ -223,7 +220,7 @@ it "shows a modal with renew information" do visit_authorizations page.find("div[data-dialog-open='renew-modal']", text: /Example authorization/).click - + sleep 5 within "#renew-modal" do expect(page).to have_content("Example authorization") expect(page).to have_content("This is the data of the current verification:") @@ -236,6 +233,7 @@ it "shows the verification form to start again" do visit_authorizations page.find("div[data-dialog-open='renew-modal']", text: /Example authorization/).click + sleep 5 within "#renew-modal" do click_on "Continue" end @@ -274,7 +272,7 @@ expect(page).to have_css("[data-verification]", text: /Example authorization/) page.find("[data-verification]", text: /Example authorization/).click end - + sleep 5 within "#renew-modal" do click_on "Continue" end @@ -297,6 +295,132 @@ end end + context "when there is onboarding action data and the user signs in" do + let(:organization) { create(:organization, available_authorizations: authorizations) } + let(:component) { create(:component, manifest_name: "dummy", organization:, permissions:) } + let(:commentable) { create(:dummy_resource, component:) } + let(:permissions) { nil } + let(:comment) { create(:comment, commentable:) } + let(:action) { :comment } + let(:extended_data) { { onboarding: { action:, model: commentable.to_gid } } } + let(:user) { create(:user, :confirmed, organization:, extended_data:) } + let(:commentable_path) { Decidim::ResourceLocatorPresenter.new(commentable).path } + let(:authorizations) { %w(dummy_authorization_handler another_dummy_authorization_handler) } + let!(:user_verification) { nil } + + before do + sign_in + end + + context "and there are no authorizations defined for the resource" do + it "the user is redirected to the resource" do + expect(page).to have_current_path commentable_path + expect(page).to have_content "You have been successfully authorized" + end + end + + context "and there are authorizations defined for the resource" do + let!(:permissions) do + { + action => { + authorization_handlers: { + dummy_authorization_handler: { + options: { + allowed_postal_codes: "1234, 4567" + } + } + } + } + } + end + + context "and the user is not verified with the authorization" do + it "the user onboarding extended data is maintained" do + expect(user.reload.extended_data["onboarding"]).to be_present + end + + context "when there is only an authorization" do + it "the user is redirected to a page with the authorizations required to perform the action" do + expect(page).to have_current_path decidim_verifications.new_authorization_path( + handler: "dummy_authorization_handler", + postal_codes: "1234,4567", + redirect_url: decidim_verifications.onboarding_pending_authorizations_path + ) + expect(page).to have_content "We need to verify your identity" + expect(page).to have_content "Fill in your phone number" + end + end + + context "when there are more than one authorization" do + let(:permissions) do + { + action => { + authorization_handlers: { + dummy_authorization_handler: { + options: { + allowed_postal_codes: "1234, 4567" + } + }, + another_dummy_authorization_handler: { + options: {} + } + } + } + } + end + + it "the user is redirected to a page with the authorizations required to perform the action" do + expect(page).to have_current_path decidim_verifications.onboarding_pending_authorizations_path + expect(page).to have_content "You are almost ready to comment on the #{translated_attribute(commentable.title)} dummy resource" + expect(page).to have_css("a[data-verification]", text: "Example authorization") + expect(page).to have_css("a[data-verification]", text: "Another example authorization") + end + end + end + + context "and the user is verified with the authorization" do + let(:document_number) { "123456789X" } + let!(:user_verification) { create(:authorization, :granted, user:, name: "dummy_authorization_handler", metadata:) } + + context "and the authorization is granted with metadata which meets the conditions to allow the action" do + let(:metadata) do + { + "postal_code" => "1234", + "document_number" => document_number + } + end + + it "the user onboarding extended data is removed" do + expect(user.reload.extended_data["onboarding"]).to be_blank + end + + it "the user is redirected to the resource with a success message" do + expect(page).to have_current_path commentable_path + expect(page).to have_content "You have been successfully authorized" + end + end + + context "and the authorization is granted with metadata which does not meet the conditions to allow the action" do + let(:metadata) do + { + "postal_code" => "1111", + "document_number" => document_number + } + end + + it "the user onboarding extended data is removed" do + expect(user.reload.extended_data["onboarding"]).to be_blank + end + + it "the user is redirected to the resource with a failed authorization message" do + expect(page).to have_current_path commentable_path + expect(page).to have_content "You are not authorized to comment in this resource" + end + end + end + end + end + private def visit_authorizations @@ -306,4 +430,17 @@ def visit_authorizations click_on "Authorizations" end + + def sign_in + visit decidim.root_path + within "#main-bar" do + click_on("Log in") + end + + within "form.new_user", match: :first do + fill_in :session_user_email, with: user.email + fill_in :session_user_password, with: "decidim123456789" + find("*[type=submit]").click + end + end end