diff --git a/.github/workflows/lint_code.yml b/.github/workflows/lint_code.yml
index 84ee579..c8e7d8e 100644
--- a/.github/workflows/lint_code.yml
+++ b/.github/workflows/lint_code.yml
@@ -12,7 +12,7 @@ on:
env:
CI: "true"
SIMPLECOV: "true"
- RUBY_VERSION: 2.6.6
+ RUBY_VERSION: 2.7.1
jobs:
lint:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 6999b4c..9eb2d88 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -13,7 +13,8 @@ on:
env:
CI: "true"
SIMPLECOV: "true"
- RUBY_VERSION: 2.6.6
+ RUBY_VERSION: 2.7.1
+ RUBYOPT: "-W0"
jobs:
tests:
diff --git a/.rubocop.yml b/.rubocop.yml
index ea7414f..0d9e323 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -735,6 +735,10 @@ Layout/MultilineOperationIndentation:
# But it can be overridden by setting this parameter
IndentationWidth: ~
+Lint/MissingSuper:
+ Exclude:
+ - 'app/commands/**/*'
+
Style/NumericLiterals:
MinDigits: 5
diff --git a/.ruby-version b/.ruby-version
index 338a5b5..860487c 100644
--- a/.ruby-version
+++ b/.ruby-version
@@ -1 +1 @@
-2.6.6
+2.7.1
diff --git a/Gemfile b/Gemfile
index 03059c9..bf37b23 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,23 +4,21 @@ source "https://rubygems.org"
ruby RUBY_VERSION
-DECIDIM_VERSION = { git: "https://github.com/decidim/decidim.git", branch: "release/0.23-stable" }.freeze
+DECIDIM_VERSION = { git: "https://github.com/decidim/decidim.git", branch: "release/0.24-stable" }.freeze
gem "decidim", DECIDIM_VERSION
-gem "decidim-cookies", git: "https://github.com/OpenSourcePolitics/decidim-module_cookies.git", branch: "release/0.23-stable"
-gem "decidim-decidim_awesome", "~> 0.6.0"
-# gem "decidim-navbar_links", git: "https://github.com/OpenSourcePolitics/decidim-module-navbar_links.git", branch: "0.23.5"
-gem "decidim-term_customizer", git: "https://github.com/mainio/decidim-module-term_customizer.git", branch: "0.23-stable"
+gem "decidim-decidim_awesome", "~> 0.7.0"
+gem "decidim-term_customizer", git: "https://github.com/mainio/decidim-module-term_customizer.git", branch: "master"
-gem "bootsnap", "~> 1.3"
+gem "bootsnap", "~> 1.4"
gem "dotenv-rails"
-gem "puma", "~> 4.3"
+gem "puma", "~> 5.3.1"
gem "uglifier", "~> 4.1"
-gem "faker", "~> 1.8"
+gem "faker", "~> 2.14"
gem "ruby-progressbar"
diff --git a/Gemfile.lock b/Gemfile.lock
index ccdf5c1..081d049 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,86 +1,78 @@
-GIT
- remote: https://github.com/OpenSourcePolitics/decidim-module_cookies.git
- revision: 00d4d1a50a2e86b0b2446af442c4850d3020e2c7
- branch: release/0.23-stable
- specs:
- decidim-cookies (0.23.2)
- decidim-core (~> 0.23.2)
-
GIT
remote: https://github.com/decidim/decidim.git
- revision: 81a3ea3531bcd7f3fb518451aa9a2139e7c37580
- branch: release/0.23-stable
+ revision: bd81f740b5d3f147c9e2a231eb16123e36ff3845
+ branch: release/0.24-stable
specs:
- decidim (0.23.6)
- decidim-accountability (= 0.23.6)
- decidim-admin (= 0.23.6)
- decidim-api (= 0.23.6)
- decidim-assemblies (= 0.23.6)
- decidim-blogs (= 0.23.6)
- decidim-budgets (= 0.23.6)
- decidim-comments (= 0.23.6)
- decidim-core (= 0.23.6)
- decidim-debates (= 0.23.6)
- decidim-forms (= 0.23.6)
- decidim-generators (= 0.23.6)
- decidim-meetings (= 0.23.6)
- decidim-pages (= 0.23.6)
- decidim-participatory_processes (= 0.23.6)
- decidim-proposals (= 0.23.6)
- decidim-sortitions (= 0.23.6)
- decidim-surveys (= 0.23.6)
- decidim-system (= 0.23.6)
- decidim-verifications (= 0.23.6)
- decidim-accountability (0.23.6)
- decidim-comments (= 0.23.6)
- decidim-core (= 0.23.6)
+ decidim (0.24.3)
+ decidim-accountability (= 0.24.3)
+ decidim-admin (= 0.24.3)
+ decidim-api (= 0.24.3)
+ decidim-assemblies (= 0.24.3)
+ decidim-blogs (= 0.24.3)
+ decidim-budgets (= 0.24.3)
+ decidim-comments (= 0.24.3)
+ decidim-core (= 0.24.3)
+ decidim-debates (= 0.24.3)
+ decidim-forms (= 0.24.3)
+ decidim-generators (= 0.24.3)
+ decidim-meetings (= 0.24.3)
+ decidim-pages (= 0.24.3)
+ decidim-participatory_processes (= 0.24.3)
+ decidim-proposals (= 0.24.3)
+ decidim-sortitions (= 0.24.3)
+ decidim-surveys (= 0.24.3)
+ decidim-system (= 0.24.3)
+ decidim-templates (= 0.24.3)
+ decidim-verifications (= 0.24.3)
+ decidim-accountability (0.24.3)
+ decidim-comments (= 0.24.3)
+ decidim-core (= 0.24.3)
kaminari (~> 1.2, >= 1.2.1)
searchlight (~> 4.1)
- decidim-admin (0.23.6)
+ decidim-admin (0.24.3)
active_link_to (~> 1.0)
- decidim-core (= 0.23.6)
+ decidim-core (= 0.24.3)
devise (~> 4.7)
devise-i18n (~> 1.2)
devise_invitable (~> 1.7)
- jquery-rails (~> 4.3)
- sassc (~> 2.3.0)
+ jquery-rails (~> 4.4)
+ sassc (~> 2.4.0)
sassc-rails (~> 2.1.2)
- decidim-api (0.23.6)
+ decidim-api (0.24.3)
graphiql-rails (~> 1.4, < 1.5)
- graphql (~> 1.9)
+ graphql (~> 1.12, >= 1.12.3)
rack-cors (~> 1.0)
- redcarpet (~> 3.4)
+ redcarpet (~> 3.5, >= 3.5.1)
sprockets-es6 (~> 0.9.2)
- decidim-assemblies (0.23.6)
- decidim-core (= 0.23.6)
- decidim-blogs (0.23.6)
- decidim-admin (= 0.23.6)
- decidim-comments (= 0.23.6)
- decidim-core (= 0.23.6)
- httparty (~> 0.17)
+ decidim-assemblies (0.24.3)
+ decidim-core (= 0.24.3)
+ decidim-blogs (0.24.3)
+ decidim-admin (= 0.24.3)
+ decidim-comments (= 0.24.3)
+ decidim-core (= 0.24.3)
jquery-tmpl-rails (~> 1.1)
kaminari (~> 1.2, >= 1.2.1)
- decidim-budgets (0.23.6)
- decidim-comments (= 0.23.6)
- decidim-core (= 0.23.6)
+ decidim-budgets (0.24.3)
+ decidim-comments (= 0.24.3)
+ decidim-core (= 0.24.3)
kaminari (~> 1.2, >= 1.2.1)
searchlight (~> 4.1)
- decidim-comments (0.23.6)
- decidim-core (= 0.23.6)
- jquery-rails (~> 4.3)
- redcarpet (~> 3.4)
- decidim-core (0.23.6)
+ decidim-comments (0.24.3)
+ decidim-core (= 0.24.3)
+ jquery-rails (~> 4.4)
+ redcarpet (~> 3.5, >= 3.5.1)
+ decidim-core (0.24.3)
active_link_to (~> 1.0)
- anchored (>= 1.1.0)
+ anchored (~> 1.1)
autoprefixer-rails (~> 8.0)
batch-loader (~> 1.2)
browser (~> 2.7)
- carrierwave (~> 1.3)
+ carrierwave (~> 2.2.1)
cells-erb (~> 0.1.0)
cells-rails (~> 0.0.9)
charlock_holmes (~> 0.7)
date_validator (~> 0.9.0)
- decidim-api (= 0.23.6)
+ decidim-api (= 0.24.3)
devise (~> 4.7)
devise-i18n (~> 1.2)
diffy (~> 3.3)
@@ -88,12 +80,13 @@ GIT
doorkeeper-i18n (~> 4.0)
etherpad-lite (~> 0.3)
file_validators (~> 2.1)
+ fog-local (~> 0.6)
foundation-rails (~> 6.6, < 6.7)
foundation_rails_helper (~> 3.0)
- geocoder (>= 1.5)
+ geocoder (~> 1.5)
hashdiff (>= 0.4.0, < 2.0.0)
invisible_captcha (~> 0.12)
- jquery-rails (~> 4.3)
+ jquery-rails (~> 4.4)
kaminari (~> 1.2, >= 1.2.1)
loofah (~> 2.3.1)
mini_magick (~> 4.9)
@@ -108,7 +101,7 @@ GIT
pg (~> 1.1.4, < 2)
pg_search (~> 2.2)
premailer-rails (~> 1.10)
- rack (>= 2.2.3)
+ rack (~> 2.2, >= 2.2.3)
rack-attack (~> 6.0)
rails (~> 5.2.6)
rails-i18n (~> 5.0)
@@ -116,7 +109,7 @@ GIT
redis (~> 4.1)
request_store (~> 1.5.0)
rubyzip (~> 2.0)
- sassc (~> 2.3.0)
+ sassc (~> 2.4.0)
sassc-rails (~> 2.1.2)
seven_zip_ruby (~> 1.3)
social-share-button (~> 1.2, >= 1.2.1)
@@ -127,95 +120,100 @@ GIT
uglifier (~> 4.1)
valid_email2 (~> 2.1)
wisper (~> 2.0)
- decidim-debates (0.23.6)
- decidim-comments (= 0.23.6)
- decidim-core (= 0.23.6)
+ decidim-debates (0.24.3)
+ decidim-comments (= 0.24.3)
+ decidim-core (= 0.24.3)
kaminari (~> 1.2, >= 1.2.1)
searchlight (~> 4.1)
- decidim-dev (0.23.6)
+ decidim-dev (0.24.3)
byebug (~> 11.0)
capybara (~> 3.24)
db-query-matchers (~> 0.9.0)
- decidim (= 0.23.6)
+ decidim (= 0.24.3)
erb_lint (~> 0.0.28)
factory_bot_rails (~> 4.8)
i18n-tasks (~> 0.9.18)
mdl (~> 0.5)
- nokogiri (>= 1.10.8)
- puma (>= 4.3)
+ nokogiri (~> 1.11, >= 1.11.4)
+ puffing-billy (~> 2.4.0)
+ puma (~> 5.0)
rails-controller-testing (~> 1.0)
rspec-cells (~> 0.3.4)
rspec-html-matchers (~> 0.9.1)
rspec-rails (~> 3.7)
rspec-retry (~> 0.6.2)
rspec_junit_formatter (~> 0.3.0)
- rubocop (~> 0.71.0)
+ rubocop (~> 0.92.0)
rubocop-rails (~> 2.0)
rubocop-rspec (~> 1.21)
selenium-webdriver (~> 3.142)
simplecov (~> 0.19.0)
simplecov-cobertura (~> 1.3.1)
system_test_html_screenshots (~> 0.1.1)
+ vcr (~> 6.0)
webmock (~> 3.6)
wisper-rspec (~> 1.0)
- decidim-forms (0.23.6)
- decidim-core (= 0.23.6)
+ decidim-forms (0.24.3)
+ decidim-core (= 0.24.3)
wicked_pdf (~> 1.4)
wkhtmltopdf-binary (~> 0.12)
- decidim-generators (0.23.6)
- decidim-core (= 0.23.6)
- decidim-meetings (0.23.6)
+ decidim-generators (0.24.3)
+ decidim-core (= 0.24.3)
+ decidim-meetings (0.24.3)
cells-erb (~> 0.1.0)
cells-rails (~> 0.0.9)
- decidim-core (= 0.23.6)
- decidim-forms (= 0.23.6)
- httparty (~> 0.17)
+ decidim-core (= 0.24.3)
+ decidim-forms (= 0.24.3)
icalendar (~> 2.5)
jquery-tmpl-rails (~> 1.1)
kaminari (~> 1.2, >= 1.2.1)
searchlight (~> 4.1)
- decidim-pages (0.23.6)
- decidim-core (= 0.23.6)
- decidim-participatory_processes (0.23.6)
- decidim-core (= 0.23.6)
- decidim-proposals (0.23.6)
+ decidim-pages (0.24.3)
+ decidim-core (= 0.24.3)
+ decidim-participatory_processes (0.24.3)
+ decidim-core (= 0.24.3)
+ decidim-proposals (0.24.3)
acts_as_list (~> 0.9)
cells-erb (~> 0.1.0)
cells-rails (~> 0.0.9)
- decidim-comments (= 0.23.6)
- decidim-core (= 0.23.6)
- doc2text (~> 0.4.2)
+ decidim-comments (= 0.24.3)
+ decidim-core (= 0.24.3)
+ doc2text (~> 0.4.3)
kaminari (~> 1.2, >= 1.2.1)
ransack (~> 2.1.1)
- redcarpet (~> 3.4)
- decidim-sortitions (0.23.6)
- decidim-admin (= 0.23.6)
- decidim-comments (= 0.23.6)
- decidim-core (= 0.23.6)
- decidim-proposals (= 0.23.6)
- decidim-surveys (0.23.6)
- decidim-core (= 0.23.6)
- decidim-forms (= 0.23.6)
- decidim-system (0.23.6)
+ redcarpet (~> 3.5, >= 3.5.1)
+ decidim-sortitions (0.24.3)
+ decidim-admin (= 0.24.3)
+ decidim-comments (= 0.24.3)
+ decidim-core (= 0.24.3)
+ decidim-proposals (= 0.24.3)
+ decidim-surveys (0.24.3)
+ decidim-core (= 0.24.3)
+ decidim-forms (= 0.24.3)
+ decidim-templates (= 0.24.3)
+ decidim-system (0.24.3)
active_link_to (~> 1.0)
- decidim-core (= 0.23.6)
+ decidim-core (= 0.24.3)
devise (~> 4.7)
devise-i18n (~> 1.2)
devise_invitable (~> 1.7)
- jquery-rails (~> 4.3)
- sassc (~> 2.3.0)
+ jquery-rails (~> 4.4)
+ sassc (~> 2.4.0)
sassc-rails (~> 2.1.2)
- decidim-verifications (0.23.6)
- decidim-core (= 0.23.6)
+ decidim-templates (0.24.3)
+ decidim-core (= 0.24.3)
+ decidim-forms (= 0.24.3)
+ decidim-verifications (0.24.3)
+ decidim-core (= 0.24.3)
GIT
remote: https://github.com/mainio/decidim-module-term_customizer.git
- revision: c3fdec9f863351cc2e236cb03e2ab57ff7380ed7
- branch: 0.23-stable
+ revision: 0e823f4f768f6255de57559c618dcad784c5d655
+ branch: master
specs:
- decidim-term_customizer (0.23.0)
- decidim-admin (~> 0.23.0)
- decidim-core (~> 0.23.0)
+ decidim-term_customizer (0.24.0)
+ decidim-admin (~> 0.24.0)
+ decidim-core (~> 0.24.0)
GEM
remote: https://rubygems.org/
@@ -297,18 +295,22 @@ GEM
browser (2.7.1)
builder (3.2.4)
byebug (11.1.3)
- capybara (3.35.3)
+ capybara (3.36.0)
addressable
+ matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
- carrierwave (1.3.2)
- activemodel (>= 4.0.0)
- activesupport (>= 4.0.0)
- mime-types (>= 1.16)
+ carrierwave (2.2.2)
+ activemodel (>= 5.0.0)
+ activesupport (>= 5.0.0)
+ addressable (~> 2.6)
+ image_processing (~> 1.1)
+ marcel (~> 1.0.0)
+ mini_mime (>= 0.1.3)
ssrf_filter (~> 1.0)
cells (4.1.7)
declarative-builder (< 0.2.0)
@@ -322,7 +324,7 @@ GEM
actionpack (>= 3.0)
cells (>= 4.1.6, < 5.0.0)
charlock_holmes (0.7.7)
- chef-utils (17.2.29)
+ chef-utils (17.7.22)
concurrent-ruby
childprocess (3.0.0)
coercible (1.0.0)
@@ -336,10 +338,11 @@ GEM
coffee-script-source (1.12.2)
concurrent-ruby (1.1.9)
connection_pool (2.2.5)
+ cookiejar (0.3.3)
crack (0.4.5)
rexml
crass (1.0.6)
- css_parser (1.9.0)
+ css_parser (1.10.0)
addressable
dalli (2.7.11)
date_validator (0.9.0)
@@ -348,11 +351,10 @@ GEM
db-query-matchers (0.9.0)
activesupport (>= 4.0, <= 6.0)
rspec (~> 3.0)
- decidim-decidim_awesome (0.6.7)
- decidim-admin (>= 0.22.0, < 0.24)
- decidim-core (>= 0.22.0, < 0.24)
- redcarpet (~> 3.4)
- sassc (~> 2.3.0)
+ decidim-decidim_awesome (0.7.2)
+ decidim-admin (>= 0.23.0, < 0.25)
+ decidim-core (>= 0.23.0, < 0.25)
+ sassc (~> 2.3)
declarative-builder (0.1.0)
declarative-option (< 0.2.0)
declarative-option (0.1.0)
@@ -378,7 +380,7 @@ GEM
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
- doorkeeper (5.5.2)
+ doorkeeper (5.5.4)
railties (>= 5)
doorkeeper-i18n (4.0.1)
dotenv (2.7.6)
@@ -386,6 +388,16 @@ GEM
dotenv (= 2.7.6)
railties (>= 3.2)
e2mmap (0.1.0)
+ em-http-request (1.1.7)
+ addressable (>= 2.3.4)
+ cookiejar (!= 0.3.1)
+ em-socksify (>= 0.3)
+ eventmachine (>= 1.0.3)
+ http_parser.rb (>= 0.6.0)
+ em-socksify (0.3.2)
+ eventmachine (>= 1.0.0.beta.4)
+ em-synchrony (1.0.6)
+ eventmachine (>= 1.0.0.beta.1)
equalizer (0.0.11)
erb_lint (0.0.37)
activesupport
@@ -402,6 +414,8 @@ GEM
tzinfo
etherpad-lite (0.3.0)
rest-client (>= 1.6)
+ eventmachine (1.2.7)
+ eventmachine_httpserver (0.2.1)
excon (0.84.0)
execjs (2.8.1)
factory_bot (4.11.1)
@@ -409,8 +423,8 @@ GEM
factory_bot_rails (4.11.1)
factory_bot (~> 4.11.1)
railties (>= 3.0.0)
- faker (1.9.6)
- i18n (>= 0.7)
+ faker (2.19.0)
+ i18n (>= 1.6, < 2)
faraday (1.5.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
@@ -445,6 +459,8 @@ GEM
fog-json (1.2.0)
fog-core
multi_json (~> 1.10)
+ fog-local (0.7.0)
+ fog-core (>= 1.27, < 3.0)
fog-xml (0.1.3)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
@@ -462,13 +478,13 @@ GEM
fugit (1.5.0)
et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.4)
- geocoder (1.6.7)
+ geocoder (1.7.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
graphiql-rails (1.4.11)
railties
sprockets-rails
- graphql (1.12.13)
+ graphql (1.12.17)
hashdiff (1.0.1)
hashie (4.1.0)
highline (2.0.3)
@@ -477,9 +493,7 @@ GEM
http-accept (1.7.0)
http-cookie (1.0.4)
domain_name (~> 0.5)
- httparty (0.18.1)
- mime-types (~> 3.0)
- multi_xml (>= 0.5.2)
+ http_parser.rb (0.6.0)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
i18n-tasks (0.9.34)
@@ -494,19 +508,21 @@ GEM
terminal-table (>= 1.5.1)
icalendar (2.7.1)
ice_cube (~> 0.16)
- ice_cube (0.16.3)
+ ice_cube (0.16.4)
ice_nine (0.11.2)
+ image_processing (1.12.1)
+ mini_magick (>= 4.9.5, < 5)
+ ruby-vips (>= 2.0.17, < 3)
invisible_captcha (0.13.0)
rails (>= 3.2.0)
ipaddress (0.8.3)
- jaro_winkler (1.5.4)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-tmpl-rails (1.1.0)
rails (>= 3.1.0)
- jwt (2.2.3)
+ jwt (2.3.0)
kaminari (1.2.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1)
@@ -544,7 +560,8 @@ GEM
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
- marcel (1.0.1)
+ marcel (1.0.2)
+ matrix (0.4.2)
mdl (0.11.0)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
@@ -571,7 +588,7 @@ GEM
mustache (1.1.1)
netrc (0.11.0)
newrelic_rpm (7.2.0)
- nio4r (2.5.7)
+ nio4r (2.5.8)
nobspw (0.6.2)
nokogiri (1.11.7)
mini_portile2 (~> 2.5.0)
@@ -609,8 +626,8 @@ GEM
paper_trail (10.3.1)
activerecord (>= 4.2)
request_store (~> 1.1)
- parallel (1.20.1)
- parser (3.0.1.1)
+ parallel (1.21.0)
+ parser (3.0.2.0)
ast (~> 2.4.1)
passenger (6.0.9)
rack
@@ -627,7 +644,15 @@ GEM
actionmailer (>= 3)
premailer (~> 1.7, >= 1.7.9)
public_suffix (4.0.6)
- puma (4.3.8)
+ puffing-billy (2.4.1)
+ addressable (~> 2.5)
+ em-http-request (~> 1.1, >= 1.1.0)
+ em-synchrony
+ eventmachine (~> 1.2)
+ eventmachine_httpserver
+ http_parser.rb (~> 0.6.0)
+ multi_json
+ puma (5.3.2)
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.5.2)
@@ -703,9 +728,9 @@ GEM
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
- rspec-cells (0.3.5)
+ rspec-cells (0.3.7)
cells (>= 4.0.0, < 6.0.0)
- rspec-rails (< 5.0)
+ rspec-rails (< 6.0)
rspec-core (3.9.3)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.4)
@@ -730,20 +755,28 @@ GEM
rspec-support (3.9.4)
rspec_junit_formatter (0.3.0)
rspec-core (>= 2, < 4, != 2.12.0)
- rubocop (0.71.0)
- jaro_winkler (~> 1.5.1)
+ rubocop (0.92.0)
parallel (~> 1.10)
- parser (>= 2.6)
+ parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
+ regexp_parser (>= 1.7)
+ rexml
+ rubocop-ast (>= 0.5.0)
ruby-progressbar (~> 1.7)
- unicode-display_width (>= 1.4.0, < 1.7)
- rubocop-rails (2.0.1)
+ unicode-display_width (>= 1.4.0, < 2.0)
+ rubocop-ast (1.12.0)
+ parser (>= 3.0.1.1)
+ rubocop-rails (2.9.1)
+ activesupport (>= 4.2.0)
rack (>= 1.1)
- rubocop (>= 0.70.0)
- rubocop-rspec (1.41.0)
- rubocop (>= 0.68.1)
+ rubocop (>= 0.90.0, < 2.0)
+ rubocop-rspec (1.44.1)
+ rubocop (~> 0.87)
+ rubocop-ast (>= 0.7.1)
ruby-ole (1.2.12.2)
ruby-progressbar (1.11.0)
+ ruby-vips (2.1.3)
+ ffi (~> 1.12)
ruby2_keywords (0.0.4)
ruby_http_client (3.5.2)
rubyzip (2.3.2)
@@ -754,7 +787,7 @@ GEM
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
- sassc (2.3.0)
+ sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
@@ -798,10 +831,10 @@ GEM
simplecov-cobertura (1.3.1)
simplecov (~> 0.8)
simplecov-html (0.12.3)
- smart_properties (1.15.0)
+ smart_properties (1.16.3)
social-share-button (1.2.4)
coffee-rails
- spreadsheet (1.2.9)
+ spreadsheet (1.3.0)
ruby-ole
spring (2.1.1)
spring-watcher-listen (2.0.1)
@@ -822,7 +855,7 @@ GEM
system_test_html_screenshots (0.1.2)
actionpack (>= 5.2, < 6.0.a)
temple (0.8.2)
- terminal-table (3.0.1)
+ terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.1.0)
thread_safe (0.3.6)
@@ -840,11 +873,12 @@ GEM
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
- unf_ext (0.0.7.7)
- unicode-display_width (1.6.1)
+ unf_ext (0.0.8)
+ unicode-display_width (1.8.0)
valid_email2 (2.3.1)
activemodel (>= 3.2)
mail (~> 2.5)
+ vcr (6.0.0)
virtus (1.0.5)
axiom-types (~> 0.1)
coercible (~> 1.0)
@@ -857,8 +891,8 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
- webmock (3.13.0)
- addressable (>= 2.3.6)
+ webmock (3.14.0)
+ addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.5)
@@ -876,24 +910,23 @@ PLATFORMS
ruby
DEPENDENCIES
- bootsnap (~> 1.3)
+ bootsnap (~> 1.4)
byebug (~> 11.0)
dalli
decidim!
- decidim-cookies!
- decidim-decidim_awesome (~> 0.6.0)
+ decidim-decidim_awesome (~> 0.7.0)
decidim-dev!
decidim-term_customizer!
deepl-rb
dotenv-rails
- faker (~> 1.8)
+ faker (~> 2.14)
fog-aws
letter_opener_web (~> 1.3)
listen (~> 3.1)
lograge
newrelic_rpm
passenger
- puma (~> 4.3)
+ puma (~> 5.3.1)
ruby-progressbar
sendgrid-ruby
sentry-rails
@@ -908,7 +941,7 @@ DEPENDENCIES
web-console (~> 3.5)
RUBY VERSION
- ruby 2.6.6p146
+ ruby 2.7.1p83
BUNDLED WITH
2.2.24
diff --git a/app/assets/stylesheets/decidim/email.scss.erb b/app/assets/stylesheets/decidim/email.scss.erb
index eb00e73..8677e88 100644
--- a/app/assets/stylesheets/decidim/email.scss.erb
+++ b/app/assets/stylesheets/decidim/email.scss.erb
@@ -1,2 +1,2 @@
@import "<%= Gem.loaded_specs['decidim-core'].full_gem_path %>/app/assets/stylesheets/decidim/email.scss";
-@import "email-custom"
\ No newline at end of file
+@import "email-custom";
\ No newline at end of file
diff --git a/app/forms/decidim/registration_form.rb b/app/forms/decidim/registration_form.rb
index 9f20acf..0f07d3d 100644
--- a/app/forms/decidim/registration_form.rb
+++ b/app/forms/decidim/registration_form.rb
@@ -23,7 +23,7 @@ class RegistrationForm < Form
validates :password, password: { name: :name, email: :email, username: :nickname }
validates :password_confirmation, presence: true
validates :tos_agreement, allow_nil: false, acceptance: true
- validates :birthdate, format: %r{\A(0?[1-9]|[12][0-9]|3[01])[/](0?[1-9]|1[012])[/\-]\d{4}\z}, presence: true
+ validates :birthdate, format: %r{\A(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])[/\-]\d{4}\z}, presence: true
validates :postal_code, presence: true
validate :email_unique_in_organization
diff --git a/app/jobs/decidim/machine_translation_resource_job.rb b/app/jobs/decidim/machine_translation_resource_job.rb
deleted file mode 100644
index 2110a95..0000000
--- a/app/jobs/decidim/machine_translation_resource_job.rb
+++ /dev/null
@@ -1,114 +0,0 @@
-# frozen_string_literal: true
-
-module Decidim
- # This job is part of the machine translation flow. This one is fired every
- # time a `Decidim::TranslatableResource` is created or updated. If any of the
- # attributes defines as translatable is modified, then for each of those
- # attributes this job will schedule a `Decidim::MachineTranslationFieldsJob`.
- class MachineTranslationResourceJob < ApplicationJob
- queue_as :default
-
- # Performs the job.
- #
- # resource - Any kind of `Decidim::TranslatableResource` model instance
- # previous_changes - A Hash with the set fo changes. This is intended to be
- # taken from `resource.previous_changes`, but we need to manually pass
- # them to the job because the value gets lost when serializing the
- # resource.
- # source_locale - A Symbol representing the source locale for the translation
- def perform(resource, previous_changes, source_locale)
- return unless Decidim.machine_translation_service_klass
-
- @resource = resource
- @locales_to_be_translated = []
- translatable_fields = @resource.class.translatable_fields_list.map(&:to_s)
- translatable_fields.each do |field|
- next unless @resource[field].is_a?(Hash) && previous_changes.keys.include?(field)
-
- translated_locales = translated_locales_list(field)
- remove_duplicate_translations(field, translated_locales) if @resource[field]["machine_translations"].present?
-
- next unless default_locale_changed_or_translation_removed(previous_changes, field)
-
- @locales_to_be_translated += pending_locales(translated_locales) if @locales_to_be_translated.blank?
-
- @locales_to_be_translated.each do |target_locale|
- Decidim::MachineTranslationFieldsJob.perform_later(
- @resource,
- field,
- resource_field_value(
- previous_changes,
- field,
- source_locale
- ),
- target_locale,
- source_locale
- )
- end
- end
- end
-
- def default_locale_changed_or_translation_removed(previous_changes, field)
- default_locale = default_locale(@resource)
- values = previous_changes[field]
- old_value = values.first
- new_value = values.last
- return true unless old_value.is_a?(Hash)
-
- return true if old_value[default_locale] != new_value[default_locale]
-
- # In a case where the default locale isn't changed
- # but a translation of a different locale is deleted
- # We trigger a job to translate only for that locale
- if old_value[default_locale] == new_value[default_locale]
- locales_present = old_value.keys
- locales_present.each do |locale|
- @locales_to_be_translated << locale if old_value[locale] != new_value[locale] && new_value[locale] == ""
- end
- end
-
- @locales_to_be_translated.present?
- end
-
- def resource_field_value(previous_changes, field, source_locale)
- values = previous_changes[field]
- new_value = values.last
- return new_value[source_locale || default_locale(@resource)] if new_value.is_a?(Hash)
-
- new_value
- end
-
- def default_locale(resource)
- if resource.respond_to? :organization
- resource.organization.default_locale.to_s
- else
- Decidim.available_locales.first.to_s
- end
- end
-
- def translated_locales_list(field)
- return nil unless @resource[field].is_a? Hash
-
- translated_locales = []
- existing_locales = @resource[field].keys - ["machine_translations"]
- existing_locales.each do |locale|
- translated_locales << locale if @resource[field][locale].present?
- end
-
- translated_locales
- end
-
- def remove_duplicate_translations(field, translated_locales)
- machine_translated_locale = @resource[field]["machine_translations"].keys
- unless (translated_locales & machine_translated_locale).nil?
- (translated_locales & machine_translated_locale).each { |key| @resource[field]["machine_translations"].delete key }
- end
- end
-
- def pending_locales(translated_locales)
- available_locales = @resource.organization.available_locales.map(&:to_s) if @resource.respond_to? :organization
- available_locales ||= Decidim.available_locales.map(&:to_s)
- available_locales - translated_locales
- end
- end
-end
diff --git a/app/views/layouts/decidim/_main_footer.html.erb b/app/views/layouts/decidim/_main_footer.html.erb
index c271461..e22ea12 100644
--- a/app/views/layouts/decidim/_main_footer.html.erb
+++ b/app/views/layouts/decidim/_main_footer.html.erb
@@ -20,9 +20,6 @@
<% end %>
<% end %>
<%= link_to t("layouts.decidim.footer.download_open_data"), decidim.open_data_download_path %>
- <% if cookies_accepted? %>
- <%= link_to t("layouts.decidim.footer.revoke_cookies"), "#", id: "reset-button" %>
- <% end %>
<%= render partial: "layouts/decidim/social_media_links" %>
diff --git a/config/application.rb b/config/application.rb
index fbf3546..1151672 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -11,15 +11,20 @@
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
+def database_exists?
+ ActiveRecord::Base.connection
+rescue ActiveRecord::NoDatabaseError
+ false
+else
+ true
+end
+
module DevelopmentApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
config.time_zone = "Europe/Paris"
- # rubocop:disable Rails/FilePath
config.i18n.load_path += Dir[Rails.root.join("config/locales/**/*.yml").to_s]
- # rubocop:enable Rails/FilePath
-
# This needs to be set for correct images URLs in emails
# DON'T FORGET to ALSO set this in `config/initializers/carrierwave.rb`
config.action_mailer.asset_host = "https://entre-vos-mains.alsace.eu"
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 1e3bb49..99b3b29 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -16,7 +16,7 @@
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
- if Rails.root.join("tmp", "caching-dev.txt").exist?
+ if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
diff --git a/config/environments/production.rb b/config/environments/production.rb
index d98b6d6..200e162 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -130,7 +130,7 @@
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
- logger = ActiveSupport::Logger.new(STDOUT)
+ logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb
index 16394c5..fd7e117 100644
--- a/config/initializers/carrierwave.rb
+++ b/config/initializers/carrierwave.rb
@@ -9,28 +9,26 @@
config.enable_processing = !Rails.env.test?
# This needs to be set for correct attachment file URLs in emails
# DON'T FORGET to ALSO set this in `config/application.rb`
- config.asset_host = "https://entre-vos-mains.alsace.eu"
+ # config.asset_host = "https://your.server.url"
end
# Setup CarrierWave to use Amazon S3. Add `gem "fog-aws" to your Gemfile.
-if ENV["HEROKU_APP_NAME"].present?
- if Rails.env.production?
- require "carrierwave/storage/fog"
+if ENV["HEROKU_APP_NAME"].present? && Rails.env.production?
+ require "carrierwave/storage/fog"
- CarrierWave.configure do |config|
- config.storage = :fog
- config.fog_provider = "fog/aws" # required
- config.fog_credentials = {
- provider: "AWS", # required
- aws_access_key_id: Rails.application.secrets.aws_access_key_id, # required
- aws_secret_access_key: Rails.application.secrets.aws_secret_access_key, # required
- region: "eu-central-1", # optional, defaults to 'us-east-1'
- host: "s3.eu-central-1.amazonaws.com" # optional, defaults to nil
- }
- config.fog_directory = "decidim-heroku" # required
- config.fog_public = true # optional, defaults to true
- config.fog_attributes = { "Cache-Control" => "max-age=#{365.days.to_i}" } # optional, defaults to {}
- config.storage = :fog
- end
+ CarrierWave.configure do |config|
+ config.storage = :fog
+ config.fog_provider = "fog/aws" # required
+ config.fog_credentials = {
+ provider: "AWS", # required
+ aws_access_key_id: Rails.application.secrets.aws_access_key_id, # required
+ aws_secret_access_key: Rails.application.secrets.aws_secret_access_key, # required
+ region: "eu-central-1", # optional, defaults to 'us-east-1'
+ host: "s3.eu-central-1.amazonaws.com" # optional, defaults to nil
+ }
+ config.fog_directory = "decidim-heroku" # required
+ config.fog_public = true # optional, defaults to true
+ config.fog_attributes = { "Cache-Control" => "max-age=#{365.days.to_i}" } # optional, defaults to {}
+ config.storage = :fog
end
end
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb
index a97c309..aaf15d3 100644
--- a/config/initializers/content_security_policy.rb
+++ b/config/initializers/content_security_policy.rb
@@ -6,17 +6,18 @@
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
-Rails.application.config.content_security_policy do |policy|
- policy.default_src :self, :https, "argus.osp.cat", Decidim::Organization.all.collect { |org| "https://#{org.host}" }.join(',')
- policy.font_src :self, :https, :data
- policy.img_src :self, :https, :data
- policy.object_src :none
- policy.script_src :self, :https, :unsafe_inline, :unsafe_eval
- policy.style_src :self, :https, :unsafe_inline
+if database_exists? && ActiveRecord::Base.connection.table_exists?(:decidim_organization)
+ Rails.application.config.content_security_policy do |policy|
+ policy.default_src :self, :https, "argus.osp.cat", Decidim::Organization.all.collect { |org| "https://#{org.host}" }.join(",")
+ policy.font_src :self, :https, :data
+ policy.img_src :self, :https, :data
+ policy.object_src :none
+ policy.script_src :self, :https, :unsafe_inline, :unsafe_eval
+ policy.style_src :self, :https, :unsafe_inline
-
- # Specify URI for violation reports
- # policy.report_uri "/csp-violation-report-endpoint"
+ # Specify URI for violation reports
+ # policy.report_uri "/csp-violation-report-endpoint"
+ end
end
# If you are using UJS then enable automatic nonce generation
diff --git a/config/initializers/cookies.rb b/config/initializers/cookies.rb
deleted file mode 100644
index cca2952..0000000
--- a/config/initializers/cookies.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-Rails.application.config.cookies = [
- {
- name: "matomo",
- title: "Matomo",
- cookies: %w(matomo_session pk_id pk_ses _pk_ref _pk_cvar),
- purposes: %w(tracking analytics)
- }
-]
diff --git a/config/initializers/decidim.rb b/config/initializers/decidim.rb
index f80b1f0..c0091ff 100644
--- a/config/initializers/decidim.rb
+++ b/config/initializers/decidim.rb
@@ -91,7 +91,7 @@
}
end
- config.base_uploads_path = ENV["HEROKU_APP_NAME"] + "/" if ENV["HEROKU_APP_NAME"].present?
+ config.base_uploads_path = "#{ENV["HEROKU_APP_NAME"]}/" if ENV["HEROKU_APP_NAME"].present?
# Machine Translation Configuration
#
# Enable machine translations
diff --git a/config/initializers/deepl.rb b/config/initializers/deepl.rb
index dffeab3..7b57f8c 100644
--- a/config/initializers/deepl.rb
+++ b/config/initializers/deepl.rb
@@ -1,7 +1,9 @@
# frozen_string_literal: true
# DeepL Translation service configuration
-DeepL.configure do |config|
- config.auth_key = Rails.application.secrets.translator[:api_key]
- config.host = Rails.application.secrets.translator[:host]
+if Rails.application.secrets.translator[:api_key].present?
+ DeepL.configure do |config|
+ config.auth_key = Rails.application.secrets.translator[:api_key]
+ config.host = Rails.application.secrets.translator[:host]
+ end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 1249c42..24b329f 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -74,7 +74,6 @@ en:
footer:
download_open_data: Open data
made_with_open_source: Made with open source
- revoke_cookies: Revoke cookies
header:
close_menu: Close menu
navigation: Navigation
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 003729c..17859b3 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -88,7 +88,6 @@ fr:
footer:
download_open_data: Données ouvertes
made_with_open_source: Site réalisé par Open Source Politics grâce au logiciel libre logiciel libre Decidim.
- revoke_cookies: Revoke cookies
header:
close_menu: Fermer
navigation: Navigation
diff --git a/config/puma.rb b/config/puma.rb
index 7fae827..a8adec5 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -6,16 +6,16 @@
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
-threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
+threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
-port ENV.fetch("PORT") { 3000 }
+port ENV.fetch("PORT", 3000)
# Specifies the `environment` that Puma will run in.
#
-environment ENV.fetch("RAILS_ENV") { "development" }
+environment ENV.fetch("RAILS_ENV", "development")
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
diff --git a/db/migrate/20211028193528_remove_show_statistics_from_organizations.decidim.rb b/db/migrate/20211028193528_remove_show_statistics_from_organizations.decidim.rb
new file mode 100644
index 0000000..cb77c10
--- /dev/null
+++ b/db/migrate/20211028193528_remove_show_statistics_from_organizations.decidim.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20200929171508)
+
+class RemoveShowStatisticsFromOrganizations < ActiveRecord::Migration[5.2]
+ def change
+ remove_column :decidim_organizations, :show_statistics
+ end
+end
diff --git a/db/migrate/20211028193529_create_decidim_user_moderations.decidim.rb b/db/migrate/20211028193529_create_decidim_user_moderations.decidim.rb
new file mode 100644
index 0000000..61c5d18
--- /dev/null
+++ b/db/migrate/20211028193529_create_decidim_user_moderations.decidim.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201010124755)
+
+class CreateDecidimUserModerations < ActiveRecord::Migration[5.2]
+ def change
+ create_table :decidim_user_moderations do |t|
+ t.belongs_to :decidim_user, foreign_key: true
+ t.integer :report_count, default: 0, null: false
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20211028193530_create_decidim_user_reports.decidim.rb b/db/migrate/20211028193530_create_decidim_user_reports.decidim.rb
new file mode 100644
index 0000000..79bdadb
--- /dev/null
+++ b/db/migrate/20211028193530_create_decidim_user_reports.decidim.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201010124756)
+
+class CreateDecidimUserReports < ActiveRecord::Migration[5.2]
+ def change
+ create_table :decidim_user_reports do |t|
+ t.integer :user_moderation_id, foreign_key: true
+ t.integer :user_id, null: false
+ t.string :reason
+ t.text :details
+
+ t.timestamps
+ end
+ add_foreign_key :decidim_user_reports, :decidim_user_moderations, column: :user_moderation_id
+ add_foreign_key :decidim_user_reports, :decidim_users, column: :user_id
+ end
+end
diff --git a/db/migrate/20211028193531_add_suspension_fields_to_decidim_users.decidim.rb b/db/migrate/20211028193531_add_suspension_fields_to_decidim_users.decidim.rb
new file mode 100644
index 0000000..d839896
--- /dev/null
+++ b/db/migrate/20211028193531_add_suspension_fields_to_decidim_users.decidim.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201010224433)
+
+class AddSuspensionFieldsToDecidimUsers < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_users, :suspended, :boolean, default: false, null: false
+ add_column :decidim_users, :suspended_at, :datetime
+ end
+end
diff --git a/db/migrate/20211028193532_create_decidim_user_suspensions.decidim.rb b/db/migrate/20211028193532_create_decidim_user_suspensions.decidim.rb
new file mode 100644
index 0000000..68b453a
--- /dev/null
+++ b/db/migrate/20211028193532_create_decidim_user_suspensions.decidim.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201011074641)
+
+class CreateDecidimUserSuspensions < ActiveRecord::Migration[5.2]
+ def change
+ create_table :decidim_user_suspensions do |t|
+ t.belongs_to :decidim_user, foreign_key: true
+ t.integer :suspending_user_id
+ t.text :justification
+
+ t.timestamps
+ end
+ add_foreign_key :decidim_user_suspensions, :decidim_users, column: :suspending_user_id
+ end
+end
diff --git a/db/migrate/20211028193533_add_current_suspension_id_to_decidim_users.decidim.rb b/db/migrate/20211028193533_add_current_suspension_id_to_decidim_users.decidim.rb
new file mode 100644
index 0000000..fa5752e
--- /dev/null
+++ b/db/migrate/20211028193533_add_current_suspension_id_to_decidim_users.decidim.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201011081626)
+
+class AddCurrentSuspensionIdToDecidimUsers < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_users, :suspension_id, :integer
+ end
+end
diff --git a/db/migrate/20211028193534_add_reported_content_to_moderations.decidim.rb b/db/migrate/20211028193534_add_reported_content_to_moderations.decidim.rb
new file mode 100644
index 0000000..d37af03
--- /dev/null
+++ b/db/migrate/20211028193534_add_reported_content_to_moderations.decidim.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201013071533)
+
+class AddReportedContentToModerations < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_moderations, :reported_content, :text
+ end
+end
diff --git a/db/migrate/20211028193535_add_locale_to_moderation_reports.decidim.rb b/db/migrate/20211028193535_add_locale_to_moderation_reports.decidim.rb
new file mode 100644
index 0000000..36bca7b
--- /dev/null
+++ b/db/migrate/20211028193535_add_locale_to_moderation_reports.decidim.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201019074554)
+
+class AddLocaleToModerationReports < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_reports, :locale, :string
+ end
+end
diff --git a/db/migrate/20211028193536_encrypt_authorization_metadatas.decidim.rb b/db/migrate/20211028193536_encrypt_authorization_metadatas.decidim.rb
new file mode 100644
index 0000000..0583061
--- /dev/null
+++ b/db/migrate/20211028193536_encrypt_authorization_metadatas.decidim.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201127114444)
+
+class EncryptAuthorizationMetadatas < ActiveRecord::Migration[5.2]
+ def up
+ Decidim::Authorization.all.each do |auth|
+ # Re-setting these values will internally convert the hash values to
+ # encypted values
+ auth.update!(
+ metadata: auth.metadata,
+ verification_metadata: auth.verification_metadata
+ )
+ end
+ end
+
+ def down
+ Decidim::Authorization.all.each do |auth|
+ # rubocop:disable Rails/SkipsModelValidations
+ auth.update_columns(
+ metadata: decrypt_hash(auth.metadata),
+ verification_metadata: decrypt_hash(auth.verification_metadata)
+ )
+ # rubocop:enable Rails/SkipsModelValidations
+ end
+ end
+
+ private
+
+ def decrypt_hash(hash)
+ hash.transform_values do |value|
+ ActiveSupport::JSON.decode(Decidim::AttributeEncryptor.decrypt(value))
+ rescue ActiveSupport::MessageEncryptor::InvalidMessage, ActiveSupport::MessageVerifier::InvalidSignature
+ value
+ end
+ end
+end
diff --git a/db/migrate/20211028193537_add_allow_public_access_to_static_pages.decidim.rb b/db/migrate/20211028193537_add_allow_public_access_to_static_pages.decidim.rb
new file mode 100644
index 0000000..5ca91ad
--- /dev/null
+++ b/db/migrate/20211028193537_add_allow_public_access_to_static_pages.decidim.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201128130723)
+
+class AddAllowPublicAccessToStaticPages < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_static_pages, :allow_public_access, :boolean, null: false, default: false
+
+ reversible do |direction|
+ direction.up do
+ # rubocop:disable Rails/SkipsModelValidations
+ Decidim::StaticPage.where(slug: "terms-and-conditions").update_all(
+ allow_public_access: true
+ )
+ # rubocop:enable Rails/SkipsModelValidations
+ end
+ end
+ end
+end
diff --git a/db/migrate/20211028193538_update_table_block_user_functionality.decidim.rb b/db/migrate/20211028193538_update_table_block_user_functionality.decidim.rb
new file mode 100644
index 0000000..a5b9c0e
--- /dev/null
+++ b/db/migrate/20211028193538_update_table_block_user_functionality.decidim.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201218144706)
+
+class UpdateTableBlockUserFunctionality < ActiveRecord::Migration[5.2]
+ def change
+ rename_column :decidim_user_suspensions, :suspending_user_id, :blocking_user_id
+ rename_table :decidim_user_suspensions, :decidim_user_blocks
+ end
+end
diff --git a/db/migrate/20211028193539_rename_decidim_user_fields_for_block_functionality.decidim.rb b/db/migrate/20211028193539_rename_decidim_user_fields_for_block_functionality.decidim.rb
new file mode 100644
index 0000000..ef43862
--- /dev/null
+++ b/db/migrate/20211028193539_rename_decidim_user_fields_for_block_functionality.decidim.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20201218145252)
+
+class RenameDecidimUserFieldsForBlockFunctionality < ActiveRecord::Migration[5.2]
+ def change
+ rename_column :decidim_users, :suspended, :blocked
+ rename_column :decidim_users, :suspended_at, :blocked_at
+ rename_column :decidim_users, :suspension_id, :block_id
+ end
+end
diff --git a/db/migrate/20211028193540_add_email_on_moderations_to_users.decidim.rb b/db/migrate/20211028193540_add_email_on_moderations_to_users.decidim.rb
new file mode 100644
index 0000000..c04978d
--- /dev/null
+++ b/db/migrate/20211028193540_add_email_on_moderations_to_users.decidim.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20210208134328)
+
+class AddEmailOnModerationsToUsers < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_users, :email_on_moderations, :boolean, default: true
+ end
+end
diff --git a/db/migrate/20211028193541_add_followable_counter_cache_to_users.decidim.rb b/db/migrate/20211028193541_add_followable_counter_cache_to_users.decidim.rb
new file mode 100644
index 0000000..1f0e002
--- /dev/null
+++ b/db/migrate/20211028193541_add_followable_counter_cache_to_users.decidim.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20210310120640)
+
+class AddFollowableCounterCacheToUsers < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_users, :follows_count, :integer, null: false, default: 0, index: true
+
+ reversible do |dir|
+ dir.up do
+ Decidim::User.reset_column_information
+ Decidim::User.find_each do |record|
+ record.class.reset_counters(record.id, :follows)
+ end
+ end
+ end
+ end
+end
diff --git a/db/migrate/20211028193542_fix_blocked_user_names_in_action_log.decidim.rb b/db/migrate/20211028193542_fix_blocked_user_names_in_action_log.decidim.rb
new file mode 100644
index 0000000..434b5e5
--- /dev/null
+++ b/db/migrate/20211028193542_fix_blocked_user_names_in_action_log.decidim.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+# This migration comes from decidim (originally 20210629172525)
+
+class FixBlockedUserNamesInActionLog < ActiveRecord::Migration[5.2]
+ def change
+ reversible do |dir|
+ dir.up do
+ execute_query(
+ update_query(
+ "coalesce(decidim_users.extended_data->>'user_name', decidim_users.name)"
+ )
+ )
+ end
+
+ dir.down do
+ execute_query(update_query("'Blocked user'::text"))
+ end
+ end
+ end
+
+ private
+
+ def update_query(user_name_replacement)
+ <<~SQL.squish
+ UPDATE decidim_action_logs
+ SET extra = jsonb_set(
+ decidim_action_logs.extra,
+ '{resource,title}',
+ to_jsonb(#{user_name_replacement})
+ )
+ FROM decidim_users
+ WHERE decidim_users.id = decidim_action_logs.resource_id
+ AND decidim_action_logs.resource_type = $1 AND decidim_action_logs.action = $2
+ SQL
+ end
+
+ def execute_query(query)
+ rawconn.prepare("statement1", query)
+ rawconn.exec_prepared("statement1", ["Decidim::User", "block"])
+ rawconn.exec("DEALLOCATE statement1")
+ end
+
+ def rawconn
+ ActiveRecord::Base.connection.raw_connection
+ end
+end
diff --git a/db/migrate/20211028193543_add_max_characters_to_decidim_forms_questions.decidim_forms.rb b/db/migrate/20211028193543_add_max_characters_to_decidim_forms_questions.decidim_forms.rb
new file mode 100644
index 0000000..b24ef1e
--- /dev/null
+++ b/db/migrate/20211028193543_add_max_characters_to_decidim_forms_questions.decidim_forms.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim_forms (originally 20210208094442)
+
+class AddMaxCharactersToDecidimFormsQuestions < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_forms_questions, :max_characters, :integer, default: 0
+ end
+end
diff --git a/db/migrate/20211028193544_set_position_to_question_matrix_rows.decidim_forms.rb b/db/migrate/20211028193544_set_position_to_question_matrix_rows.decidim_forms.rb
new file mode 100644
index 0000000..966ad5c
--- /dev/null
+++ b/db/migrate/20211028193544_set_position_to_question_matrix_rows.decidim_forms.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+# This migration comes from decidim_forms (originally 20210616153042)
+
+class SetPositionToQuestionMatrixRows < ActiveRecord::Migration[5.2]
+ def up
+ execute "UPDATE decidim_forms_question_matrix_rows SET position = id"
+ end
+
+ def down
+ execute "UPDATE decidim_forms_question_matrix_rows SET position = NULL"
+ end
+end
diff --git a/db/migrate/20211028193545_create_decidim_verifications_conflicts.decidim_verifications.rb b/db/migrate/20211028193545_create_decidim_verifications_conflicts.decidim_verifications.rb
new file mode 100644
index 0000000..53b9dab
--- /dev/null
+++ b/db/migrate/20211028193545_create_decidim_verifications_conflicts.decidim_verifications.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+# This migration comes from decidim_verifications (originally 20201028161118)
+
+class CreateDecidimVerificationsConflicts < ActiveRecord::Migration[5.2]
+ def change
+ create_table :decidim_verifications_conflicts do |t|
+ t.references :current_user, index: { name: "authorization_current_user" }, foreign_key: { to_table: :decidim_users }
+ t.references :managed_user, index: { name: "authorization_managed_user" }, foreign_key: { to_table: :decidim_users }
+ t.integer :times, default: 0
+ t.string :unique_id
+ t.boolean :solved, default: false
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20211028193546_add_hashtag_to_participatory_process_groups.decidim_participatory_processes.rb b/db/migrate/20211028193546_add_hashtag_to_participatory_process_groups.decidim_participatory_processes.rb
new file mode 100644
index 0000000..c6186ca
--- /dev/null
+++ b/db/migrate/20211028193546_add_hashtag_to_participatory_process_groups.decidim_participatory_processes.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim_participatory_processes (originally 20201007215105)
+
+class AddHashtagToParticipatoryProcessGroups < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_participatory_process_groups, :hashtag, :string
+ end
+end
diff --git a/db/migrate/20211028193547_add_metadata_columns_to_participatory_process_groups.decidim_participatory_processes.rb b/db/migrate/20211028193547_add_metadata_columns_to_participatory_process_groups.decidim_participatory_processes.rb
new file mode 100644
index 0000000..0efe84f
--- /dev/null
+++ b/db/migrate/20211028193547_add_metadata_columns_to_participatory_process_groups.decidim_participatory_processes.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+# This migration comes from decidim_participatory_processes (originally 20201008154315)
+
+class AddMetadataColumnsToParticipatoryProcessGroups < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_participatory_process_groups, :group_url, :string
+ add_column :decidim_participatory_process_groups, :developer_group, :jsonb
+ add_column :decidim_participatory_process_groups, :local_area, :jsonb
+ add_column :decidim_participatory_process_groups, :meta_scope, :jsonb
+ add_column :decidim_participatory_process_groups, :target, :jsonb
+ add_column :decidim_participatory_process_groups, :participatory_scope, :jsonb
+ add_column :decidim_participatory_process_groups, :participatory_structure, :jsonb
+ end
+end
diff --git a/db/migrate/20211028193548_rename_name_column_to_title_in_decidim_participatory_process_groups.decidim_participatory_processes.rb b/db/migrate/20211028193548_rename_name_column_to_title_in_decidim_participatory_process_groups.decidim_participatory_processes.rb
new file mode 100644
index 0000000..3efa4e7
--- /dev/null
+++ b/db/migrate/20211028193548_rename_name_column_to_title_in_decidim_participatory_process_groups.decidim_participatory_processes.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+# This migration comes from decidim_participatory_processes (originally 20201013105520)
+
+class RenameNameColumnToTitleInDecidimParticipatoryProcessGroups < ActiveRecord::Migration[5.2]
+ def up
+ rename_column :decidim_participatory_process_groups, :name, :title
+ PaperTrail::Version.where(item_type: "Decidim::ParticipatoryProcessGroup").each do |version|
+ # rubocop:disable Rails/SkipsModelValidations
+ version.update_attribute(:object_changes, version.object_changes.gsub(/^name:/, "title:")) if version.object_changes.present?
+ # rubocop:enable Rails/SkipsModelValidations
+
+ next unless version.object.present? && version.object.has_key?("name")
+
+ object = version.object
+ object["title"] = object.delete("name")
+
+ # rubocop:disable Rails/SkipsModelValidations
+ version.update_attribute(:object, object)
+ # rubocop:enable Rails/SkipsModelValidations
+ end
+ end
+
+ def down
+ PaperTrail::Version.where(item_type: "Decidim::ParticipatoryProcessGroup").each do |version|
+ # rubocop:disable Rails/SkipsModelValidations
+ version.update_attribute(:object_changes, version.object_changes.gsub(/^title:/, "name:")) if version.object_changes.present?
+ # rubocop:enable Rails/SkipsModelValidations
+
+ next unless version.object.present? && version.object.has_key?("title")
+
+ object = version.object
+ object["name"] = object.delete("title")
+
+ # rubocop:disable Rails/SkipsModelValidations
+ version.update_attribute(:object, object)
+ # rubocop:enable Rails/SkipsModelValidations
+ end
+ rename_column :decidim_participatory_process_groups, :title, :name
+ end
+end
diff --git a/db/migrate/20211028193549_add_promoted_flag_to_decidim_participatory_process_groups.decidim_participatory_processes.rb b/db/migrate/20211028193549_add_promoted_flag_to_decidim_participatory_process_groups.decidim_participatory_processes.rb
new file mode 100644
index 0000000..e63002a
--- /dev/null
+++ b/db/migrate/20211028193549_add_promoted_flag_to_decidim_participatory_process_groups.decidim_participatory_processes.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim_participatory_processes (originally 20201030133444)
+
+class AddPromotedFlagToDecidimParticipatoryProcessGroups < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_participatory_process_groups, :promoted, :boolean, default: false, index: true
+ end
+end
diff --git a/db/migrate/20211028193550_add_weight_field_to_participatory_processes.decidim_participatory_processes.rb b/db/migrate/20211028193550_add_weight_field_to_participatory_processes.decidim_participatory_processes.rb
new file mode 100644
index 0000000..f9a3d2a
--- /dev/null
+++ b/db/migrate/20211028193550_add_weight_field_to_participatory_processes.decidim_participatory_processes.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim_participatory_processes (originally 20210204154593)
+
+class AddWeightFieldToParticipatoryProcesses < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_participatory_processes, :weight, :integer, null: false, default: true
+ end
+end
diff --git a/db/migrate/20211028193551_add_followable_counter_cache_to_participatory_processes.decidim_participatory_processes.rb b/db/migrate/20211028193551_add_followable_counter_cache_to_participatory_processes.decidim_participatory_processes.rb
new file mode 100644
index 0000000..188adcd
--- /dev/null
+++ b/db/migrate/20211028193551_add_followable_counter_cache_to_participatory_processes.decidim_participatory_processes.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+# This migration comes from decidim_participatory_processes (originally 20210310120750)
+
+class AddFollowableCounterCacheToParticipatoryProcesses < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_participatory_processes, :follows_count, :integer, null: false, default: 0, index: true
+
+ reversible do |dir|
+ dir.up do
+ Decidim::ParticipatoryProcess.reset_column_information
+ Decidim::ParticipatoryProcess.find_each do |record|
+ record.class.reset_counters(record.id, :follows)
+ end
+ end
+ end
+ end
+end
diff --git a/db/migrate/20211028193552_add_weight_field_to_assembly.decidim_assemblies.rb b/db/migrate/20211028193552_add_weight_field_to_assembly.decidim_assemblies.rb
new file mode 100644
index 0000000..d111eb0
--- /dev/null
+++ b/db/migrate/20211028193552_add_weight_field_to_assembly.decidim_assemblies.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim_assemblies (originally 20210204152393)
+
+class AddWeightFieldToAssembly < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_assemblies, :weight, :integer, null: false, default: true
+ end
+end
diff --git a/db/migrate/20211028193553_add_followable_counter_cache_to_assemblies.decidim_assemblies.rb b/db/migrate/20211028193553_add_followable_counter_cache_to_assemblies.decidim_assemblies.rb
new file mode 100644
index 0000000..f56e5f3
--- /dev/null
+++ b/db/migrate/20211028193553_add_followable_counter_cache_to_assemblies.decidim_assemblies.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+# This migration comes from decidim_assemblies (originally 20210310120444)
+
+class AddFollowableCounterCacheToAssemblies < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_assemblies, :follows_count, :integer, null: false, default: 0, index: true
+
+ reversible do |dir|
+ dir.up do
+ Decidim::Assembly.reset_column_information
+ Decidim::Assembly.find_each do |record|
+ record.class.reset_counters(record.id, :follows)
+ end
+ end
+ end
+ end
+end
diff --git a/db/migrate/20211028193554_add_online_meeting_url.decidim_meetings.rb b/db/migrate/20211028193554_add_online_meeting_url.decidim_meetings.rb
new file mode 100644
index 0000000..0536c12
--- /dev/null
+++ b/db/migrate/20211028193554_add_online_meeting_url.decidim_meetings.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim_meetings (originally 20201006140511)
+
+class AddOnlineMeetingUrl < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_meetings_meetings, :online_meeting_url, :string
+ end
+end
diff --git a/db/migrate/20211028193555_add_type_of_meeting.decidim_meetings.rb b/db/migrate/20211028193555_add_type_of_meeting.decidim_meetings.rb
new file mode 100644
index 0000000..a429f88
--- /dev/null
+++ b/db/migrate/20211028193555_add_type_of_meeting.decidim_meetings.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim_meetings (originally 20201009124057)
+
+class AddTypeOfMeeting < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_meetings_meetings, :type_of_meeting, :string, default: "in_person"
+ end
+end
diff --git a/db/migrate/20211028193556_add_registration_type_and_url_to_meetings.decidim_meetings.rb b/db/migrate/20211028193556_add_registration_type_and_url_to_meetings.decidim_meetings.rb
new file mode 100644
index 0000000..e564d4a
--- /dev/null
+++ b/db/migrate/20211028193556_add_registration_type_and_url_to_meetings.decidim_meetings.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+# This migration comes from decidim_meetings (originally 20201016112641)
+
+class AddRegistrationTypeAndUrlToMeetings < ActiveRecord::Migration[5.2]
+ class Meetings < ApplicationRecord
+ self.table_name = :decidim_meetings_meetings
+ include Decidim::HasComponent
+ end
+
+ def change
+ add_column :decidim_meetings_meetings, :registration_type, :string, null: false, default: "registration_disabled"
+ add_column :decidim_meetings_meetings, :registration_url, :string
+
+ Meetings.reset_column_information
+ Meetings.find_each do |meeting|
+ meeting.registration_type = "on_this_platform" if meeting.decidim_author_type == "Decidim::Organization"
+ meeting.save!
+ end
+ end
+end
diff --git a/db/migrate/20211028193557_add_followable_counter_cache_to_meetings.decidim_meetings.rb b/db/migrate/20211028193557_add_followable_counter_cache_to_meetings.decidim_meetings.rb
new file mode 100644
index 0000000..fa6d924
--- /dev/null
+++ b/db/migrate/20211028193557_add_followable_counter_cache_to_meetings.decidim_meetings.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+# This migration comes from decidim_meetings (originally 20210310120731)
+
+class AddFollowableCounterCacheToMeetings < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_meetings_meetings, :follows_count, :integer, null: false, default: 0, index: true
+
+ reversible do |dir|
+ dir.up do
+ Decidim::Meetings::Meeting.reset_column_information
+ Decidim::Meetings::Meeting.find_each do |record|
+ record.class.reset_counters(record.id, :follows)
+ end
+ end
+ end
+ end
+end
diff --git a/db/migrate/20211028193558_add_followable_counter_cache_to_proposals.decidim_proposals.rb b/db/migrate/20211028193558_add_followable_counter_cache_to_proposals.decidim_proposals.rb
new file mode 100644
index 0000000..0eb81ad
--- /dev/null
+++ b/db/migrate/20211028193558_add_followable_counter_cache_to_proposals.decidim_proposals.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+# This migration comes from decidim_proposals (originally 20210310102839)
+
+class AddFollowableCounterCacheToProposals < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_proposals_proposals, :follows_count, :integer, null: false, default: 0, index: true
+
+ reversible do |dir|
+ dir.up do
+ Decidim::Proposals::Proposal.reset_column_information
+ Decidim::Proposals::Proposal.find_each do |record|
+ record.class.reset_counters(record.id, :follows)
+ end
+ end
+ end
+ end
+end
diff --git a/db/migrate/20211028193559_add_followable_counter_cache_to_collaborative_drafts.decidim_proposals.rb b/db/migrate/20211028193559_add_followable_counter_cache_to_collaborative_drafts.decidim_proposals.rb
new file mode 100644
index 0000000..1d9209c
--- /dev/null
+++ b/db/migrate/20211028193559_add_followable_counter_cache_to_collaborative_drafts.decidim_proposals.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+# This migration comes from decidim_proposals (originally 20210310120812)
+
+class AddFollowableCounterCacheToCollaborativeDrafts < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_proposals_collaborative_drafts, :follows_count, :integer, null: false, default: 0, index: true
+
+ reversible do |dir|
+ dir.up do
+ Decidim::Proposals::CollaborativeDraft.reset_column_information
+ Decidim::Proposals::CollaborativeDraft.find_each do |record|
+ record.class.reset_counters(record.id, :follows)
+ end
+ end
+ end
+ end
+end
diff --git a/db/migrate/20211028193560_add_followable_counter_cache_to_budgets.decidim_budgets.rb b/db/migrate/20211028193560_add_followable_counter_cache_to_budgets.decidim_budgets.rb
new file mode 100644
index 0000000..8b8d045
--- /dev/null
+++ b/db/migrate/20211028193560_add_followable_counter_cache_to_budgets.decidim_budgets.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+# This migration comes from decidim_budgets (originally 20210310120613)
+
+class AddFollowableCounterCacheToBudgets < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_budgets_projects, :follows_count, :integer, null: false, default: 0, index: true
+
+ reversible do |dir|
+ dir.up do
+ Decidim::Budgets::Project.reset_column_information
+ Decidim::Budgets::Project.find_each do |record|
+ record.class.reset_counters(record.id, :follows)
+ end
+ end
+ end
+ end
+end
diff --git a/db/migrate/20211028193561_add_scope_to_debates_debate.decidim_debates.rb b/db/migrate/20211028193561_add_scope_to_debates_debate.decidim_debates.rb
new file mode 100644
index 0000000..2aa4596
--- /dev/null
+++ b/db/migrate/20211028193561_add_scope_to_debates_debate.decidim_debates.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+# This migration comes from decidim_debates (originally 20200930145546)
+
+class AddScopeToDebatesDebate < ActiveRecord::Migration[5.2]
+ def change
+ add_reference :decidim_debates_debates, :decidim_scope, foreign_key: true, index: true
+ end
+end
diff --git a/db/migrate/20211028193562_archive_debates.decidim_debates.rb b/db/migrate/20211028193562_archive_debates.decidim_debates.rb
new file mode 100644
index 0000000..886ddff
--- /dev/null
+++ b/db/migrate/20211028193562_archive_debates.decidim_debates.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+# This migration comes from decidim_debates (originally 20201126112752)
+
+class ArchiveDebates < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_debates_debates, :archived_at, :datetime
+ add_index :decidim_debates_debates, :archived_at
+ end
+end
diff --git a/db/migrate/20211028193563_revert_archive_debates.decidim_debates.rb b/db/migrate/20211028193563_revert_archive_debates.decidim_debates.rb
new file mode 100644
index 0000000..a543242
--- /dev/null
+++ b/db/migrate/20211028193563_revert_archive_debates.decidim_debates.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+# This migration comes from decidim_debates (originally 20210125101735)
+
+class RevertArchiveDebates < ActiveRecord::Migration[5.2]
+ def change
+ remove_index :decidim_debates_debates, :archived_at
+ remove_column :decidim_debates_debates, :archived_at
+ end
+end
diff --git a/db/migrate/20211028193564_add_followable_counter_cache_to_debates.decidim_debates.rb b/db/migrate/20211028193564_add_followable_counter_cache_to_debates.decidim_debates.rb
new file mode 100644
index 0000000..a91eb4d
--- /dev/null
+++ b/db/migrate/20211028193564_add_followable_counter_cache_to_debates.decidim_debates.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+# This migration comes from decidim_debates (originally 20210310120652)
+
+class AddFollowableCounterCacheToDebates < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_debates_debates, :follows_count, :integer, null: false, default: 0, index: true
+
+ reversible do |dir|
+ dir.up do
+ Decidim::Debates::Debate.reset_column_information
+ Decidim::Debates::Debate.find_each do |record|
+ record.class.reset_counters(record.id, :follows)
+ end
+ end
+ end
+ end
+end
diff --git a/db/migrate/20211028193565_add_followable_counter_cache_to_blogs.decidim_blogs.rb b/db/migrate/20211028193565_add_followable_counter_cache_to_blogs.decidim_blogs.rb
new file mode 100644
index 0000000..6542c75
--- /dev/null
+++ b/db/migrate/20211028193565_add_followable_counter_cache_to_blogs.decidim_blogs.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+# This migration comes from decidim_blogs (originally 20210310120514)
+
+class AddFollowableCounterCacheToBlogs < ActiveRecord::Migration[5.2]
+ def change
+ add_column :decidim_blogs_posts, :follows_count, :integer, null: false, default: 0, index: true
+
+ reversible do |dir|
+ dir.up do
+ Decidim::Blogs::Post.reset_column_information
+ Decidim::Blogs::Post.find_each do |record|
+ record.class.reset_counters(record.id, :follows)
+ end
+ end
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 37ed761..aebf795 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2021_07_26_155447) do
+ActiveRecord::Schema.define(version: 2021_10_28_193565) do
# These are extensions that must be enabled in order to support this database
enable_extension "ltree"
@@ -170,6 +170,8 @@
t.string "youtube_handler"
t.string "github_handler"
t.bigint "decidim_assemblies_type_id"
+ t.integer "weight", default: 1, null: false
+ t.integer "follows_count", default: 0, null: false
t.index ["decidim_area_id"], name: "index_decidim_assemblies_on_decidim_area_id"
t.index ["decidim_assemblies_type_id"], name: "index_decidim_assemblies_on_decidim_assemblies_type_id"
t.index ["decidim_organization_id", "slug"], name: "index_unique_assembly_slug_and_organization", unique: true
@@ -303,6 +305,7 @@
t.integer "decidim_user_group_id"
t.integer "endorsements_count", default: 0, null: false
t.integer "comments_count", default: 0, null: false
+ t.integer "follows_count", default: 0, null: false
t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_blogs_posts_on_decidim_author"
t.index ["decidim_component_id"], name: "index_decidim_blogs_posts_on_decidim_component_id"
t.index ["decidim_user_group_id"], name: "index_decidim_blogs_posts_on_decidim_user_group_id"
@@ -353,6 +356,7 @@
t.bigint "decidim_budgets_budget_id"
t.date "selected_at"
t.integer "comments_count", default: 0, null: false
+ t.integer "follows_count", default: 0, null: false
t.index ["decidim_budgets_budget_id"], name: "index_decidim_budgets_projects_on_decidim_budgets_budget_id"
t.index ["decidim_scope_id"], name: "index_decidim_budgets_projects_on_decidim_scope_id"
end
@@ -509,9 +513,12 @@
t.datetime "last_comment_at"
t.integer "last_comment_by_id"
t.string "last_comment_by_type"
+ t.bigint "decidim_scope_id"
+ t.integer "follows_count", default: 0, null: false
t.index ["closed_at"], name: "index_decidim_debates_debates_on_closed_at"
t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_debates_debates_on_decidim_author"
t.index ["decidim_component_id"], name: "index_decidim_debates_debates_on_decidim_component_id"
+ t.index ["decidim_scope_id"], name: "index_decidim_debates_debates_on_decidim_scope_id"
t.index ["decidim_user_group_id"], name: "index_decidim_debates_debates_on_decidim_user_group_id"
t.index ["endorsements_count"], name: "idx_decidim_debates_debates_on_endorsemnts_count"
end
@@ -620,6 +627,7 @@
t.integer "max_choices"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.integer "max_characters", default: 0
t.index ["decidim_questionnaire_id"], name: "index_decidim_forms_questions_on_decidim_questionnaire_id"
t.index ["position"], name: "index_decidim_forms_questions_on_position"
end
@@ -731,6 +739,11 @@
t.integer "decidim_user_group_id"
t.integer "comments_count", default: 0, null: false
t.string "salt"
+ t.string "online_meeting_url"
+ t.string "type_of_meeting", default: "in_person"
+ t.string "registration_type", default: "registration_disabled", null: false
+ t.string "registration_url"
+ t.integer "follows_count", default: 0, null: false
t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_meetings_meetings_on_author"
t.index ["decidim_author_id"], name: "index_decidim_meetings_meetings_on_decidim_author_id"
t.index ["decidim_component_id"], name: "index_decidim_meetings_meetings_on_decidim_component_id"
@@ -834,6 +847,7 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "decidim_participatory_space_type", null: false
+ t.text "reported_content"
t.index ["decidim_participatory_space_id", "decidim_participatory_space_type"], name: "decidim_moderations_participatory_space"
t.index ["decidim_reportable_type", "decidim_reportable_id"], name: "decidim_moderations_reportable", unique: true
t.index ["hidden_at"], name: "decidim_moderations_hidden_at"
@@ -897,7 +911,6 @@
t.jsonb "description"
t.string "logo"
t.string "twitter_handler"
- t.boolean "show_statistics", default: true
t.string "favicon"
t.string "instagram_handler"
t.string "facebook_handler"
@@ -957,12 +970,21 @@
end
create_table "decidim_participatory_process_groups", id: :serial, force: :cascade do |t|
- t.jsonb "name", null: false
+ t.jsonb "title", null: false
t.jsonb "description", null: false
t.string "hero_image"
t.integer "decidim_organization_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.string "hashtag"
+ t.string "group_url"
+ t.jsonb "developer_group"
+ t.jsonb "local_area"
+ t.jsonb "meta_scope"
+ t.jsonb "target"
+ t.jsonb "participatory_scope"
+ t.jsonb "participatory_structure"
+ t.boolean "promoted", default: false
t.index ["decidim_organization_id"], name: "decidim_participatory_process_group_organization"
end
@@ -1026,6 +1048,8 @@
t.bigint "decidim_area_id"
t.bigint "decidim_scope_type_id"
t.boolean "show_metrics", default: true
+ t.integer "weight", default: 1, null: false
+ t.integer "follows_count", default: 0, null: false
t.index ["decidim_area_id"], name: "index_decidim_participatory_processes_on_decidim_area_id"
t.index ["decidim_organization_id", "slug"], name: "index_unique_process_slug_and_organization", unique: true
t.index ["decidim_organization_id"], name: "index_decidim_processes_on_decidim_organization_id"
@@ -1083,6 +1107,7 @@
t.datetime "updated_at", null: false
t.integer "coauthorships_count", default: 0, null: false
t.integer "comments_count", default: 0, null: false
+ t.integer "follows_count", default: 0, null: false
t.index ["body"], name: "decidim_proposals_collaborative_draft_body_search"
t.index ["decidim_component_id"], name: "decidim_proposals_collaborative_drafts_on_decidim_component_id"
t.index ["decidim_scope_id"], name: "decidim_proposals_collaborative_drafts_on_decidim_scope_id"
@@ -1151,6 +1176,7 @@
t.jsonb "title"
t.jsonb "body"
t.integer "comments_count", default: 0, null: false
+ t.integer "follows_count", default: 0, null: false
t.index "md5((body)::text)", name: "decidim_proposals_proposal_body_search"
t.index "md5((title)::text)", name: "decidim_proposals_proposal_title_search"
t.index ["created_at"], name: "index_decidim_proposals_proposals_on_created_at"
@@ -1177,6 +1203,7 @@
t.text "details"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.string "locale"
t.index ["decidim_moderation_id", "decidim_user_id"], name: "decidim_reports_moderation_user_unique", unique: true
t.index ["decidim_moderation_id"], name: "decidim_reports_moderation"
t.index ["decidim_user_id"], name: "decidim_reports_user"
@@ -1308,6 +1335,7 @@
t.integer "weight"
t.boolean "show_in_footer", default: false, null: false
t.bigint "topic_id"
+ t.boolean "allow_public_access", default: false, null: false
t.index ["decidim_organization_id"], name: "index_decidim_static_pages_on_decidim_organization_id"
t.index ["topic_id"], name: "index_decidim_static_pages_on_topic_id"
end
@@ -1356,6 +1384,15 @@
t.index ["translation_set_id"], name: "decidim_term_customizer_translation_translation_set"
end
+ create_table "decidim_user_blocks", force: :cascade do |t|
+ t.bigint "decidim_user_id"
+ t.integer "blocking_user_id"
+ t.text "justification"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["decidim_user_id"], name: "index_decidim_user_blocks_on_decidim_user_id"
+ end
+
create_table "decidim_user_group_memberships", id: :serial, force: :cascade do |t|
t.integer "decidim_user_id", null: false
t.integer "decidim_user_group_id", null: false
@@ -1369,6 +1406,23 @@
t.index ["role", "decidim_user_group_id"], name: "decidim_group_membership_one_creator_per_group", unique: true, where: "((role)::text = 'creator'::text)"
end
+ create_table "decidim_user_moderations", force: :cascade do |t|
+ t.bigint "decidim_user_id"
+ t.integer "report_count", default: 0, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["decidim_user_id"], name: "index_decidim_user_moderations_on_decidim_user_id"
+ end
+
+ create_table "decidim_user_reports", force: :cascade do |t|
+ t.integer "user_moderation_id"
+ t.integer "user_id", null: false
+ t.string "reason"
+ t.text "details"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
create_table "decidim_users", id: :serial, force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
@@ -1423,6 +1477,11 @@
t.datetime "admin_terms_accepted_at"
t.string "session_token"
t.string "direct_message_types", default: "all", null: false
+ t.boolean "blocked", default: false, null: false
+ t.datetime "blocked_at"
+ t.integer "block_id"
+ t.boolean "email_on_moderations", default: true
+ t.integer "follows_count", default: 0, null: false
t.index ["confirmation_token"], name: "index_decidim_users_on_confirmation_token", unique: true
t.index ["decidim_organization_id"], name: "index_decidim_users_on_decidim_organization_id"
t.index ["email", "decidim_organization_id"], name: "index_decidim_users_on_email_and_decidim_organization_id", unique: true, where: "((deleted_at IS NULL) AND (managed = false) AND ((type)::text = 'Decidim::User'::text))"
@@ -1437,6 +1496,18 @@
t.index ["unlock_token"], name: "index_decidim_users_on_unlock_token", unique: true
end
+ create_table "decidim_verifications_conflicts", force: :cascade do |t|
+ t.bigint "current_user_id"
+ t.bigint "managed_user_id"
+ t.integer "times", default: 0
+ t.string "unique_id"
+ t.boolean "solved", default: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["current_user_id"], name: "authorization_current_user"
+ t.index ["managed_user_id"], name: "authorization_managed_user"
+ end
+
create_table "decidim_verifications_csv_data", force: :cascade do |t|
t.string "email"
t.bigint "decidim_organization_id"
@@ -1520,6 +1591,7 @@
add_foreign_key "decidim_budgets_projects", "decidim_budgets_budgets"
add_foreign_key "decidim_categorizations", "decidim_categories"
add_foreign_key "decidim_comparative_stats_endpoints", "decidim_organizations"
+ add_foreign_key "decidim_debates_debates", "decidim_scopes"
add_foreign_key "decidim_identities", "decidim_organizations"
add_foreign_key "decidim_newsletters", "decidim_users", column: "author_id"
add_foreign_key "decidim_participatory_process_steps", "decidim_participatory_processes"
@@ -1533,7 +1605,14 @@
add_foreign_key "decidim_term_customizer_constraints", "decidim_organizations"
add_foreign_key "decidim_term_customizer_constraints", "decidim_term_customizer_translation_sets", column: "translation_set_id"
add_foreign_key "decidim_term_customizer_translations", "decidim_term_customizer_translation_sets", column: "translation_set_id"
+ add_foreign_key "decidim_user_blocks", "decidim_users"
+ add_foreign_key "decidim_user_blocks", "decidim_users", column: "blocking_user_id"
+ add_foreign_key "decidim_user_moderations", "decidim_users"
+ add_foreign_key "decidim_user_reports", "decidim_user_moderations", column: "user_moderation_id"
+ add_foreign_key "decidim_user_reports", "decidim_users", column: "user_id"
add_foreign_key "decidim_users", "decidim_organizations"
+ add_foreign_key "decidim_verifications_conflicts", "decidim_users", column: "current_user_id"
+ add_foreign_key "decidim_verifications_conflicts", "decidim_users", column: "managed_user_id"
add_foreign_key "decidim_verifications_csv_data", "decidim_organizations"
add_foreign_key "oauth_access_grants", "decidim_users", column: "resource_owner_id"
add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id"
diff --git a/db/seeds.rb b/db/seeds.rb
index 07b44af..7eb3125 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -9,7 +9,7 @@
# Character.create(name: 'Luke', movie: movies.first)
# You can remove the 'faker' gem if you don't want Decidim seeds.
if ENV["HEROKU_APP_NAME"].present?
- ENV["DECIDIM_HOST"] = ENV["HEROKU_APP_NAME"] + ".herokuapp.com"
+ ENV["DECIDIM_HOST"] = "#{ENV["HEROKU_APP_NAME"]}.herokuapp.com"
ENV["SEED"] = "true"
end
Decidim.seed!
diff --git a/lib/helpers/decidim/dev/test/base_spec_helper.rb b/lib/helpers/decidim/dev/test/base_spec_helper.rb
new file mode 100644
index 0000000..93853dd
--- /dev/null
+++ b/lib/helpers/decidim/dev/test/base_spec_helper.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+require "decidim/dev"
+
+ENV["RAILS_ENV"] ||= "test"
+
+engine_spec_dir = File.join(Dir.pwd, "spec")
+
+require "simplecov" if ENV["SIMPLECOV"]
+
+require "decidim/core"
+require "decidim/core/test"
+require "decidim/admin/test"
+
+require_relative "rspec_support/component"
+require_relative "rspec_support/authorization"
+
+require "#{Decidim::Dev.dummy_app_path}/config/environment"
+
+Dir["#{engine_spec_dir}/shared/**/*.rb"].sort.each { |f| require f }
+
+require "paper_trail/frameworks/rspec"
+
+require_relative "spec_helper"
+
+if ENV["CI"]
+ require "rspec/retry"
+
+ RSpec.configure do |config|
+ # show retry status in spec process
+ config.verbose_retry = true
+ # show exception that triggers a retry if verbose_retry is set to true
+ config.display_try_failure_messages = true
+
+ # Retry failed test, set to 1 for normal behavior
+ config.default_retry_count = ENV.fetch("FAILED_TEST_RETRY_COUNT", 3)
+ end
+end
diff --git a/lib/tasks/heroku.rake b/lib/tasks/heroku.rake
deleted file mode 100644
index 06c12cd..0000000
--- a/lib/tasks/heroku.rake
+++ /dev/null
@@ -1,76 +0,0 @@
-# frozen_string_literal: true
-
-namespace :heroku do
- desc "Deploy a test version on heroku"
- task setup: :environment do
- if ENV["SECRET_KEY_BASE"].nil?
- puts "No SECRET_KEY_BASE found !"
- puts "export SECRET_KEY_BASE first : "
- puts "export SECRET_KEY_BASE=#{`bundle exe rake secret`}"
- exit 1
- end
-
- if ENV["AWS_ACCESS_KEY_ID"].nil?
- puts "No AWS_ACCESS_KEY_ID found !"
- puts "export AWS_ACCESS_KEY_ID first"
- exit 1
- end
-
- if ENV["AWS_SECRET_ACCESS_KEY"].nil?
- puts "No SECRET_KEY_BASE found !"
- puts "export AWS_SECRET_ACCESS_KEY first"
- exit 1
- end
-
- skip_first_login_authorization = ENV["SKIP_FIRST_LOGIN_AUTHORIZATION"].nil? ? true : ENV["SKIP_FIRST_LOGIN_AUTHORIZATION"]
-
- if system("heroku create #{app_name} --region eu")
- system("heroku addons:create newrelic:wayne -a #{app_name}")
- system("heroku addons:create heroku-redis:hobby-dev -a #{app_name}")
- system("heroku addons:create memcachedcloud:30 -a #{app_name}")
- system("heroku addons:create sentry:f1 -a #{app_name}")
- system("heroku addons:create sendgrid:starter -a #{app_name}")
- system("heroku labs:enable runtime-dyno-metadata -a #{app_name}")
- system("heroku config:set SEED=true -a #{app_name}")
- system("heroku config:set SKIP_FIRST_LOGIN_AUTHORIZATION=#{skip_first_login_authorization} -a #{app_name}")
- system("heroku config:set SECRET_KEY_BASE=$SECRET_KEY_BASE -a #{app_name}")
- system("heroku config:set AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID")
- system("heroku config:set AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY")
- system("heroku git:remote -a #{app_name}")
- if system("git push heroku $(git rev-parse --abbrev-ref HEAD):master")
- if system("heroku run rails db:migrate")
- system("heroku run rails db:seed")
- display_url
- end
- end
- end
- end
-
- task push: :environment do
- system("git push heroku $(git rev-parse --abbrev-ref HEAD):master")
- system("heroku run rails db:migrate")
- display_url
- end
-
- task url: :environment do
- display_url
- end
-
- task remote: :environment do
- system("git remote remove heroku")
- system("heroku git:remote -a #{app_name}")
- end
-
- def display_url
- puts "Deploy is over, visit your app : #{`heroku apps:info -s | grep web_url | cut -d= -f2`}"
- end
-
- def app_name
- app_name_raw = `git rev-parse --abbrev-ref HEAD`
- digit = /\d.\d.-/.match(app_name_raw)
-
- return app_name_raw.tr("_", "-")[0..29].chomp if digit.nil?
-
- app_name_raw.gsub(digit[0], "").tr("_", "-")[0..29].chomp
- end
-end
diff --git a/spec/commands/decidim/create_registration_spec.rb b/spec/commands/decidim/create_registration_spec.rb
index 3c102d5..5121542 100644
--- a/spec/commands/decidim/create_registration_spec.rb
+++ b/spec/commands/decidim/create_registration_spec.rb
@@ -46,7 +46,7 @@ module Comments
describe "when the form is not valid" do
before do
- expect(form).to receive(:invalid?).and_return(true)
+ allow(form).to receive(:invalid?).and_return(true)
end
it "broadcasts invalid" do
diff --git a/spec/jobs/decidim/machine_translation_resource_job_spec.rb b/spec/jobs/decidim/machine_translation_resource_job_spec.rb
index c2d45c8..044f7af 100644
--- a/spec/jobs/decidim/machine_translation_resource_job_spec.rb
+++ b/spec/jobs/decidim/machine_translation_resource_job_spec.rb
@@ -41,36 +41,7 @@ module Decidim
end
end
- describe "when the content is submitted in other language than default" do
- let(:current_locale) { "es" }
-
- before do
- updated_title = { es: "título actualizado" }
- process.update(title: updated_title)
- clear_enqueued_jobs
- end
-
- it "doesn't enqueue the machine translation fields job" do
- Decidim::MachineTranslationResourceJob.perform_now(
- process,
- process.translatable_previous_changes,
- current_locale
- )
- expect(Decidim::MachineTranslationFieldsJob)
- .to have_been_enqueued
- .on_queue("default")
- .at_least(2).times
- .with(
- process,
- "title",
- "título actualizado",
- kind_of(String),
- current_locale
- )
- end
- end
-
- describe "when default locale of translatable field isn't changed" do
+ describe "when default loacle of translatable field isn't changed" do
before do
updated_title = { en: "New Title", es: "título actualizado" }
process.update(title: updated_title)
diff --git a/spec/jobs/decidim/machine_translation_save_job_spec.rb b/spec/jobs/decidim/machine_translation_save_job_spec.rb
index 40a91fc..4d9be5f 100644
--- a/spec/jobs/decidim/machine_translation_save_job_spec.rb
+++ b/spec/jobs/decidim/machine_translation_save_job_spec.rb
@@ -68,5 +68,76 @@ module Decidim
)
end
end
+
+ describe "when the resource is reported" do
+ let(:organization) { create(:organization) }
+ let(:participatory_space) { create(:participatory_process, organization: organization) }
+ let!(:moderators) { create_list(:user, 3, :admin, organization: organization) }
+ let(:moderation) { create(:moderation, report_count: 2, participatory_space: participatory_space) }
+ let!(:report) { create(:report, moderation: moderation) }
+ let(:title) { { "ca" => "Títol" } }
+ let(:proposal) { build(:proposal, title: title, body: { "ca" => "Proposta" }, moderation: moderation) }
+ let(:translated_value) { "Proposal" }
+
+ describe "and the target language is the organization's default" do
+ let(:target_locale) { "en" }
+
+ describe "and the resource is completely translated" do
+ let(:title) { { "ca" => "Títol", "machine_translations" => { "en" => "Title" } } }
+
+ it "sends emails to the moderators" do
+ allow(ReportedMailer).to receive(:report).and_call_original
+
+ proposal.save
+ MachineTranslationSaveJob.perform_now(
+ proposal,
+ "body",
+ target_locale,
+ translated_value
+ )
+
+ expect(ReportedMailer)
+ .to have_received(:report)
+ .exactly(moderation.participatory_space.moderators.count).times
+ end
+ end
+
+ describe "and the resource is NOT completely translated" do
+ it "doesn't send emails" do
+ allow(ReportedMailer).to receive(:report).and_call_original
+
+ proposal.save
+ MachineTranslationSaveJob.perform_now(
+ proposal,
+ "body",
+ target_locale,
+ translated_value
+ )
+
+ expect(ReportedMailer)
+ .not_to have_received(:report)
+ end
+ end
+ end
+
+ describe "and the target language is NOT the organization's default" do
+ let(:target_locale) { "fi" }
+
+ it "doesn't send emails" do
+ allow(ReportedMailer).to receive(:report).and_call_original
+
+ proposal.save
+ MachineTranslationSaveJob.perform_now(
+ proposal,
+ "body",
+ target_locale,
+ translated_value
+ )
+
+ expect(ReportedMailer)
+ .not_to have_received(:report)
+ end
+ end
+ end
end
end
diff --git a/spec/system/authentication_spec.rb b/spec/system/authentication_spec.rb
index 9a2f69c..3e93124 100644
--- a/spec/system/authentication_spec.rb
+++ b/spec/system/authentication_spec.rb
@@ -22,6 +22,7 @@
fill_in :registration_user_nickname, with: "responsible"
fill_in :registration_user_password, with: "DfyvHn425mYAy2HL"
fill_in :registration_user_password_confirmation, with: "DfyvHn425mYAy2HL"
+
check :registration_user_tos_agreement
check :registration_user_newsletter
fill_in :registration_user_birthdate, with: "12/12/2021"
@@ -49,6 +50,7 @@
fill_in :registration_user_nickname, with: "responsible"
fill_in :registration_user_password, with: "DfyvHn425mYAy2HL"
fill_in :registration_user_password_confirmation, with: "DfyvHn425mYAy2HL"
+
check :registration_user_tos_agreement
check :registration_user_newsletter
fill_in :registration_user_birthdate, with: "12/12/2021"
@@ -72,6 +74,7 @@
fill_in :registration_user_nickname, with: "responsible"
fill_in :registration_user_password, with: "DfyvHn425mYAy2HL"
fill_in :registration_user_password_confirmation, with: "DfyvHn425mYAy2HL"
+
check :registration_user_tos_agreement
check :registration_user_newsletter
fill_in :registration_user_birthdate, with: "12/12/2021"
@@ -541,6 +544,7 @@
fill_in :registration_user_nickname, with: "responsible"
fill_in :registration_user_password, with: "DfyvHn425mYAy2HL"
fill_in :registration_user_password_confirmation, with: "DfyvHn425mYAy2HL"
+
check :registration_user_tos_agreement
check :registration_user_newsletter
fill_in :registration_user_birthdate, with: "12/12/2021"
diff --git a/spec/system/homepage_spec.rb b/spec/system/homepage_spec.rb
index 2310fd3..f1141b7 100644
--- a/spec/system/homepage_spec.rb
+++ b/spec/system/homepage_spec.rb
@@ -23,8 +23,6 @@
create :content_block, organization: organization, scope_name: :homepage, manifest_name: :sub_hero
create :content_block, organization: organization, scope_name: :homepage, manifest_name: :highlighted_content_banner
create :content_block, organization: organization, scope_name: :homepage, manifest_name: :how_to_participate
- create :content_block, organization: organization, scope_name: :homepage, manifest_name: :stats
- create :content_block, organization: organization, scope_name: :homepage, manifest_name: :metrics
create :content_block, organization: organization, scope_name: :homepage, manifest_name: :footer_sub_hero
switch_to_host(organization.host)
@@ -50,8 +48,8 @@
official_url: official_url,
enable_omnipresent_banner: true,
omnipresent_banner_url: "#{official_url}/processes",
- omnipresent_banner_title: Decidim::Faker::Localized.sentence(3),
- omnipresent_banner_short_description: Decidim::Faker::Localized.sentence(3))
+ omnipresent_banner_title: Decidim::Faker::Localized.sentence(word_count: 3),
+ omnipresent_banner_short_description: Decidim::Faker::Localized.sentence(word_count: 3))
end
before do
@@ -190,18 +188,19 @@
)
end
- context "when organization show_statistics attribute is false" do
- let(:organization) { create(:organization, show_statistics: false) }
+ context "when organization doesn't have the stats content block" do
+ let(:organization) { create(:organization) }
it "does not show the statistics block" do
expect(page).to have_no_content("Current state of #{organization.name}")
end
end
- context "when organization show_statistics attribute is true" do
- let(:organization) { create(:organization, show_statistics: true) }
+ context "when organization has the stats content block" do
+ let(:organization) { create(:organization) }
before do
+ create :content_block, organization: organization, scope_name: :homepage, manifest_name: :stats
visit current_path
end
@@ -226,16 +225,16 @@
end
describe "includes metrics" do
- context "when organization show_statistics attribute is false" do
- let(:organization) { create(:organization, show_statistics: false) }
+ context "when organization doesn't have the metrics content block" do
+ let(:organization) { create(:organization) }
it "does not show the statistics block" do
expect(page).to have_no_content("Participation in figures")
end
end
- context "when organization show_statistics attribute is true" do
- let(:organization) { create(:organization, show_statistics: true) }
+ context "when organization does have the metrics content block" do
+ let(:organization) { create(:organization) }
let(:metrics) do
Decidim.metrics_registry.all.each do |metric_registry|
create(:metric, metric_type: metric_registry.metric_name, day: Time.zone.today, organization: organization, cumulative: 5, quantity: 2)
@@ -245,6 +244,7 @@
context "and have metric records" do
before do
metrics
+ create :content_block, organization: organization, scope_name: :homepage, manifest_name: :metrics
visit current_path
end
@@ -263,6 +263,7 @@
context "and does not have metric records" do
before do
+ create :content_block, organization: organization, scope_name: :homepage, manifest_name: :metrics
visit current_path
end
@@ -306,10 +307,10 @@
create(:organization,
official_url: official_url,
highlighted_content_banner_enabled: true,
- highlighted_content_banner_title: Decidim::Faker::Localized.sentence(2),
- highlighted_content_banner_short_description: Decidim::Faker::Localized.sentence(2),
- highlighted_content_banner_action_title: Decidim::Faker::Localized.sentence(2),
- highlighted_content_banner_action_subtitle: Decidim::Faker::Localized.sentence(2),
+ highlighted_content_banner_title: Decidim::Faker::Localized.sentence(word_count: 2),
+ highlighted_content_banner_short_description: Decidim::Faker::Localized.sentence(word_count: 2),
+ highlighted_content_banner_action_title: Decidim::Faker::Localized.sentence(word_count: 2),
+ highlighted_content_banner_action_subtitle: Decidim::Faker::Localized.sentence(word_count: 2),
highlighted_content_banner_action_url: ::Faker::Internet.url,
highlighted_content_banner_image: Decidim::Dev.test_file("city.jpeg", "image/jpeg"))
end