diff --git a/.rubocop.yml b/.rubocop.yml index 61a117f97..cf411617d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -163,6 +163,7 @@ Layout/LineLength: - "config/environments/staging.rb" - "config/initializers/devise.rb" - "config/initializers/backtrace_silencers.rb" + - "config/initializers/cookie_rotator.rb" - "db/migrate/*create_delayed_jobs.rb" - "db/migrate/*create_active_storage_variant_records.active_storage.rb" - "app/models/budget/stats.rb" @@ -374,9 +375,6 @@ Rails/CreateTableWithTimestamps: Rails/Date: Enabled: true -Rails/DeprecatedActiveModelErrorsMethods: # TODO: Remove after upgrading to Rails 7 - Enabled: true - Rails/DurationArithmetic: Enabled: true diff --git a/Gemfile b/Gemfile index 7514d7801..8c90f3c4b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -gem "rails", "6.1.7.7" +gem "rails", "7.0.8.1" gem "acts-as-taggable-on", "~> 10.0.0" gem "acts_as_votable", "~> 0.14.0" @@ -46,13 +46,14 @@ gem "recipient_interceptor", "~> 0.3.1" gem "redcarpet", "~> 3.6.0" gem "responders", "~> 3.1.1" gem "rinku", "~> 2.0.6", require: "rails_rinku" -gem "ros-apartment", "~> 2.11.0", require: "apartment" +gem "ros-apartment", "~> 2.11.0", require: "apartment" # Remove ConnectionHandling monkey patch when upgrading gem "sassc-embedded", "~> 1.70.1" gem "sassc-rails", "~> 2.1.2" gem "savon", "~> 2.15.0" gem "sitemap_generator", "~> 6.3.0" gem "social-share-button", "~> 1.2.4" gem "sprockets", "~> 4.2.1" +gem "sprockets-rails", "~> 3.4.2", require: "sprockets/railtie" gem "turbolinks", "~> 5.2.1" gem "turnout", "~> 2.5.0" gem "uglifier", "~> 4.2.0" diff --git a/Gemfile.lock b/Gemfile.lock index 538c88148..bd616810e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,65 +2,71 @@ GEM remote: https://rubygems.org/ specs: Ascii85 (1.1.0) - actioncable (6.1.7.7) - actionpack (= 6.1.7.7) - activesupport (= 6.1.7.7) + actioncable (7.0.8.1) + actionpack (= 7.0.8.1) + activesupport (= 7.0.8.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.7) - actionpack (= 6.1.7.7) - activejob (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + actionmailbox (7.0.8.1) + actionpack (= 7.0.8.1) + activejob (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) mail (>= 2.7.1) - actionmailer (6.1.7.7) - actionpack (= 6.1.7.7) - actionview (= 6.1.7.7) - activejob (= 6.1.7.7) - activesupport (= 6.1.7.7) + net-imap + net-pop + net-smtp + actionmailer (7.0.8.1) + actionpack (= 7.0.8.1) + actionview (= 7.0.8.1) + activejob (= 7.0.8.1) + activesupport (= 7.0.8.1) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.1.7.7) - actionview (= 6.1.7.7) - activesupport (= 6.1.7.7) - rack (~> 2.0, >= 2.0.9) + actionpack (7.0.8.1) + actionview (= 7.0.8.1) + activesupport (= 7.0.8.1) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.7) - actionpack (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + actiontext (7.0.8.1) + actionpack (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.7) - activesupport (= 6.1.7.7) + actionview (7.0.8.1) + activesupport (= 7.0.8.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.7) - activesupport (= 6.1.7.7) + activejob (7.0.8.1) + activesupport (= 7.0.8.1) globalid (>= 0.3.6) - activemodel (6.1.7.7) - activesupport (= 6.1.7.7) - activerecord (6.1.7.7) - activemodel (= 6.1.7.7) - activesupport (= 6.1.7.7) - activestorage (6.1.7.7) - actionpack (= 6.1.7.7) - activejob (= 6.1.7.7) - activerecord (= 6.1.7.7) - activesupport (= 6.1.7.7) + activemodel (7.0.8.1) + activesupport (= 7.0.8.1) + activerecord (7.0.8.1) + activemodel (= 7.0.8.1) + activesupport (= 7.0.8.1) + activestorage (7.0.8.1) + actionpack (= 7.0.8.1) + activejob (= 7.0.8.1) + activerecord (= 7.0.8.1) + activesupport (= 7.0.8.1) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.7) + activesupport (7.0.8.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) acts-as-taggable-on (10.0.0) activerecord (>= 6.1, < 7.2) acts_as_votable (0.14.0) @@ -91,7 +97,7 @@ GEM execjs (~> 2) base64 (0.1.1) bcrypt (3.1.20) - better_html (2.0.2) + better_html (2.1.1) actionview (>= 6.0) activesupport (>= 6.0) ast (~> 2.0) @@ -460,21 +466,20 @@ GEM rack rack-test (2.1.0) rack (>= 1.3) - rails (6.1.7.7) - actioncable (= 6.1.7.7) - actionmailbox (= 6.1.7.7) - actionmailer (= 6.1.7.7) - actionpack (= 6.1.7.7) - actiontext (= 6.1.7.7) - actionview (= 6.1.7.7) - activejob (= 6.1.7.7) - activemodel (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + rails (7.0.8.1) + actioncable (= 7.0.8.1) + actionmailbox (= 7.0.8.1) + actionmailer (= 7.0.8.1) + actionpack (= 7.0.8.1) + actiontext (= 7.0.8.1) + actionview (= 7.0.8.1) + activejob (= 7.0.8.1) + activemodel (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) bundler (>= 1.15.0) - railties (= 6.1.7.7) - sprockets-rails (>= 2.0.0) + railties (= 7.0.8.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -482,15 +487,16 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - rails-i18n (6.0.0) + rails-i18n (7.0.9) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 7) - railties (6.1.7.7) - actionpack (= 6.1.7.7) - activesupport (= 6.1.7.7) + railties (>= 6.0.0, < 8) + railties (7.0.8.1) + actionpack (= 7.0.8.1) + activesupport (= 7.0.8.1) method_source rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.1.0) rbtree3 (0.7.1) @@ -752,7 +758,7 @@ DEPENDENCIES pronto-rubocop (~> 0.11.5) pronto-stylelint (~> 0.10.3) puma (~> 5.6.8) - rails (= 6.1.7.7) + rails (= 7.0.8.1) recipient_interceptor (~> 0.3.1) redcarpet (~> 3.6.0) responders (~> 3.1.1) @@ -776,6 +782,7 @@ DEPENDENCIES social-share-button (~> 1.2.4) spring (~> 4.1.3) sprockets (~> 4.2.1) + sprockets-rails (~> 3.4.2) turbolinks (~> 5.2.1) turnout (~> 2.5.0) uglifier (~> 4.2.0) diff --git a/app/components/admin/action_component.html.erb b/app/components/admin/action_component.html.erb index 4fb3324e8..ad80e2f5d 100644 --- a/app/components/admin/action_component.html.erb +++ b/app/components/admin/action_component.html.erb @@ -1,5 +1,5 @@ <% if button? %> - <%= button_to(path, html_options) { text } %> + <%= button_to text, path, html_options %> <% else %> <%= link_to text, path, html_options %> <% end %> diff --git a/app/components/budgets/investments/ballot_component.html.erb b/app/components/budgets/investments/ballot_component.html.erb index 2f609e146..faceb03a1 100644 --- a/app/components/budgets/investments/ballot_component.html.erb +++ b/app/components/budgets/investments/ballot_component.html.erb @@ -10,15 +10,14 @@

<% end %> <% if investment.should_show_ballots? %> - <%= button_to budget_ballot_line_path(id: investment.id, + <%= button_to t("budgets.ballots.show.remove"), + budget_ballot_line_path(id: investment.id, budget_id: investment.budget_id, investments_ids: investment_ids), class: "button button-remove-support expanded", method: :delete, remote: true, - "aria-label": remove_vote_aria_label do %> - <%= t("budgets.ballots.show.remove") %> - <% end %> + "aria-label": remove_vote_aria_label %> <% end %> <% else %> @@ -29,16 +28,15 @@

<% end %> <% if investment.should_show_ballots? %> - <%= button_to budget_ballot_lines_path(investment_id: investment.id, + <%= button_to t("budgets.investments.investment.add"), + budget_ballot_lines_path(investment_id: investment.id, budget_id: investment.budget_id, investments_ids: investment_ids), class: "button button-support expanded", title: t("budgets.investments.investment.support_title"), method: :post, remote: true, - "aria-label": vote_aria_label do %> - <%= t("budgets.investments.investment.add") %> - <% end %> + "aria-label": vote_aria_label %> <% end %> <% end %> diff --git a/app/components/budgets/investments/votes_component.html.erb b/app/components/budgets/investments/votes_component.html.erb index 015e520c9..1d86737db 100644 --- a/app/components/budgets/investments/votes_component.html.erb +++ b/app/components/budgets/investments/votes_component.html.erb @@ -12,13 +12,12 @@ <%= t("budgets.investments.votes.already_supported") %> <% if feature?(:remove_investments_supports) %> - <%= button_to remove_support_path, + <%= button_to t("budgets.investments.votes.remove_support"), + remove_support_path, class: "button button-remove-support expanded", method: "delete", remote: true, - "aria-label": remove_support_aria_label do %> - <%= t("budgets.investments.votes.remove_support") %> - <% end %> + "aria-label": remove_support_aria_label %> <% end %> <% else %> diff --git a/app/components/polls/questions/answers_component.html.erb b/app/components/polls/questions/answers_component.html.erb index c73247ec2..c9fc65343 100644 --- a/app/components/polls/questions/answers_component.html.erb +++ b/app/components/polls/questions/answers_component.html.erb @@ -2,23 +2,21 @@ <% if can?(:answer, question) && !question.poll.voted_in_booth?(current_user) %> <% question_answers.each do |question_answer| %> <% if already_answered?(question_answer) %> - <%= button_to question_answer_path(question, user_answer(question_answer)), + <%= button_to question_answer.title, + question_answer_path(question, user_answer(question_answer)), method: :delete, remote: true, title: t("poll_questions.show.voted", answer: question_answer.title), class: "button answered", - "aria-pressed": true do %> - <%= question_answer.title %> - <% end %> + "aria-pressed": true %> <% else %> - <%= button_to answer_question_path(question, answer: question_answer.title), + <%= button_to question_answer.title, + answer_question_path(question, answer: question_answer.title), remote: true, title: t("poll_questions.show.vote_answer", answer: question_answer.title), class: "button secondary hollow", "aria-pressed": false, - disabled: disable_answer?(question_answer) do %> - <%= question_answer.title %> - <% end %> + disabled: disable_answer?(question_answer) %> <% end %> <% end %> <% elsif !user_signed_in? %> diff --git a/app/components/proposals/votes_component.html.erb b/app/components/proposals/votes_component.html.erb index c96200e00..612052103 100644 --- a/app/components/proposals/votes_component.html.erb +++ b/app/components/proposals/votes_component.html.erb @@ -7,14 +7,13 @@ <%= t("proposals.proposal.already_supported") %> <% else %> - <%= button_to vote_url, + <%= button_to t("proposals.proposal.support"), + vote_url, class: "button button-support small expanded", title: t("proposals.proposal.support_title"), method: "post", remote: true, - "aria-label": support_aria_label do %> - <%= t("proposals.proposal.support") %> - <% end %> + "aria-label": support_aria_label %> <% end %> diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 8d5e2fe4f..e8a8f441d 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -11,7 +11,7 @@ class NotificationsController < ApplicationController def show @notification = current_user.notifications.find(params[:id]) @notification.mark_as_read - redirect_to linkable_resource_path(@notification) + redirect_to linkable_resource_path(@notification), allow_other_host: true end def read diff --git a/app/models/concerns/skip_validation.rb b/app/models/concerns/skip_validation.rb index 7c1a3c549..214b67e21 100644 --- a/app/models/concerns/skip_validation.rb +++ b/app/models/concerns/skip_validation.rb @@ -12,8 +12,8 @@ module SkipValidation _validators[field].reject! { |existing_validator| existing_validator.is_a?(validator_class) } _validate_callbacks.each do |callback| - if callback.raw_filter.is_a?(validator_class) - callback.raw_filter.instance_variable_set(:@attributes, callback.raw_filter.attributes - [field]) + if callback.filter.is_a?(validator_class) + callback.filter.instance_variable_set(:@attributes, callback.filter.attributes - [field]) end end end diff --git a/config/application.rb b/config/application.rb index a4cc6006b..deaf238f6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,7 +13,6 @@ require "action_mailer/railtie" # require "action_text/engine" require "action_view/railtie" require "action_cable/engine" -require "sprockets/railtie" require "rails/test_unit/railtie" # Require the gems listed in Gemfile, including any gems @@ -22,16 +21,12 @@ Bundler.require(*Rails.groups) module Consul class Application < Rails::Application - config.load_defaults 6.1 + config.load_defaults 7.0 # Keep belongs_to fields optional by default, because that's the way # Rails 4 models worked config.active_record.belongs_to_required_by_default = false - # Keep using AES-256-CBC for message encryption in case it's used - # in any CONSUL DEMOCRACY installations - config.active_support.use_authenticated_message_encryption = false - # Don't enable has_many_inversing because it doesn't seem to currently # work with the _count database columns we use for caching purposes config.active_record.has_many_inversing = false @@ -39,6 +34,15 @@ module Consul # Disable Sprockets AssetUrlProcessor for CKEditor compatibility config.assets.resolve_assets_in_css_urls = false + # Keep adding media="screen" attribute to stylesheets, just like + # Rails 4, 5 and 6 did, until we change the print stylesheet so it + # works when loading all the styles + config.action_view.apply_stylesheet_media_default = true + + # Keep using ImageMagick instead of libvips for image processing in + # order to make upgrades easier. + config.active_storage.variant_processor = :mini_magick + # Keep reading existing data in the legislation_annotations ranges column config.active_record.yaml_column_permitted_classes = [ActiveSupport::HashWithIndifferentAccess, Symbol] diff --git a/config/environments/development.rb b/config/environments/development.rb index df04c5583..ab669e80b 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -15,9 +15,12 @@ Rails.application.configure do # Show full error reports. config.consider_all_requests_local = true + # Enable server timing + config.server_timing = true + # 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.action_controller.enable_fragment_cache_logging = true @@ -58,11 +61,6 @@ Rails.application.configure do # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = false - # Suppress logger output for asset requests. config.assets.quiet = true @@ -89,9 +87,6 @@ Rails.application.configure do Bullet.add_footer = true end end - # Use an evented file watcher to asynchronously detect changes in source code, - # routes, locales, etc. This feature depends on the listen gem. - # config.file_watcher = ActiveSupport::EventedFileUpdateChecker # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 57ba25c25..36ee4d03d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -74,18 +74,13 @@ Rails.application.configure do config.action_mailer.smtp_settings = Rails.application.secrets.smtp_settings end - # Disable locale fallbacks for I18n - # (prevents using fallback locales set in application.rb). - # config.i18n.fallbacks = false + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + # (commented because it prevents using fallback locales set in application.rb). + # config.i18n.fallbacks = true - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Log disallowed deprecations. - config.active_support.disallowed_deprecation = :log - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] + # Don't log any deprecations. + config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new @@ -107,27 +102,6 @@ Rails.application.configure do # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - - # Inserts middleware to perform automatic connection switching. - # The `database_selector` hash is used to pass options to the DatabaseSelector - # middleware. The `delay` is used to determine how long to wait after a write - # to send a subsequent read to the primary. - # - # The `database_resolver` class is used by the middleware to determine which - # database is appropriate to use based on the time delay. - # - # The `database_resolver_context` class is used by the middleware to set - # timestamps for the last write to the primary. The resolver uses the context - # class timestamps to determine how long to wait before reading from the - # replica. - # - # By default Rails will store a last write timestamp in the session. The - # DatabaseSelector middleware is designed as such you can define your own - # strategy for connection switching and pass that into the middleware through - # these configuration options. - # config.active_record.database_selector = { delay: 2.seconds } - # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver - # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session end require Rails.root.join("config", "environments", "custom", "production") diff --git a/config/environments/test.rb b/config/environments/test.rb index 369978ed2..5c9b0b58d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -15,11 +15,12 @@ Rails.application.configure do config.i18n.default_locale = :en config.i18n.available_locales = %w[de en es fr nl pt-BR zh-CN] + # Turn false under Spring and add config.action_view.cache_template_loading = true. config.cache_classes = true - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. diff --git a/config/initializers/01_filter_parameter_logging.rb b/config/initializers/01_filter_parameter_logging.rb index 4b34a0366..adc6568ce 100644 --- a/config/initializers/01_filter_parameter_logging.rb +++ b/config/initializers/01_filter_parameter_logging.rb @@ -1,6 +1,8 @@ # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. +# Configure parameters to be filtered from the log file. Use this to limit dissemination of +# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported +# notations and behaviors. Rails.application.config.filter_parameters += [ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn ] diff --git a/config/initializers/apartment.rb b/config/initializers/apartment.rb index cda7ae581..e5d0a5110 100644 --- a/config/initializers/apartment.rb +++ b/config/initializers/apartment.rb @@ -1,3 +1,20 @@ +module ActiveRecord # TODO: Remove after upgrading ros-apartment + # Code based on the current (as of March 2024) development version of the apartment gem + module ConnectionHandling + def connected_to_with_rails7_tenant(role: nil, prevent_writes: false, &blk) + current_tenant = Apartment::Tenant.current + + # The connected_to_without_tenant method is defined by Apartment + connected_to_without_tenant(role: role, prevent_writes: prevent_writes) do + Apartment::Tenant.switch!(current_tenant) + yield(blk) + end + end + + alias connected_to connected_to_with_rails7_tenant + end +end + # You can have Apartment route to the appropriate Tenant by adding some Rack middleware. # Apartment can support many different "Elevators" that can take care of this routing to your data. # Require whichever Elevator you're using below or none if you have a custom one. diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 41c43016f..54f47cf15 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,28 +1,25 @@ # Be sure to restart your server when you modify this file. -# Define an application-wide content security policy -# For further information see the following documentation -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header -# Rails.application.config.content_security_policy do |policy| -# policy.default_src :self, :https -# policy.font_src :self, :https, :data -# policy.img_src :self, :https, :data -# policy.object_src :none -# policy.script_src :self, :https -# policy.style_src :self, :https - -# # Specify URI for violation reports -# # policy.report_uri "/csp-violation-report-endpoint" +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap and inline scripts +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true # end - -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/cookie_rotator.rb b/config/initializers/cookie_rotator.rb new file mode 100644 index 000000000..b82c9de1d --- /dev/null +++ b/config/initializers/cookie_rotator.rb @@ -0,0 +1,23 @@ +# This code was copied from: +# https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html#key-generator-digest-class-changing-to-use-sha256 +# TODO: safe to remove after upgrading to Rails 7.1 or releasing a new +# version of Consul Democracy +Rails.application.config.after_initialize do + Rails.application.config.action_dispatch.cookies_rotations.tap do |cookies| + authenticated_encrypted_cookie_salt = Rails.application.config.action_dispatch.authenticated_encrypted_cookie_salt + signed_cookie_salt = Rails.application.config.action_dispatch.signed_cookie_salt + + secret_key_base = Rails.application.secret_key_base + + key_generator = ActiveSupport::KeyGenerator.new( + secret_key_base, iterations: 1000, hash_digest_class: OpenSSL::Digest::SHA1 + ) + key_len = ActiveSupport::MessageEncryptor.key_len + + old_encrypted_secret = key_generator.generate_key(authenticated_encrypted_cookie_salt, key_len) + old_signed_secret = key_generator.generate_key(signed_cookie_salt) + + cookies.rotate :encrypted, old_encrypted_secret + cookies.rotate :signed, old_signed_secret + end +end diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb deleted file mode 100644 index 5a6a32d37..000000000 --- a/config/initializers/cookies_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Specify a serializer for the signed and encrypted cookie jars. -# Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 17b2717d6..951175208 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -4,15 +4,15 @@ # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' +# inflect.acronym "RESTful" # end ActiveSupport::Inflector.inflections(:en) do |inflect| diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb deleted file mode 100644 index bbfc3961b..000000000 --- a/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] -end - -# To enable root element in JSON for ActiveRecord objects. -# ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true -# end diff --git a/db/migrate/20240322223950_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20240322223950_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 000000000..93c8b85ad --- /dev/null +++ b/db/migrate/20240322223950_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb @@ -0,0 +1,8 @@ +# This migration comes from active_storage (originally 20211119233751) +class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + change_column_null(:active_storage_blobs, :checksum, true) + end +end diff --git a/db/schema.rb b/db/schema.rb index f416da10e..761958871 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,8 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2023_10_12_141318) do - +ActiveRecord::Schema[7.0].define(version: 2024_03_22_223950) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" enable_extension "plpgsql" @@ -20,16 +19,16 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "active_poll_translations", id: :serial, force: :cascade do |t| t.integer "active_poll_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.text "description" t.index ["active_poll_id"], name: "index_active_poll_translations_on_active_poll_id" t.index ["locale"], name: "index_active_poll_translations_on_locale" end create_table "active_polls", id: :serial, force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "active_storage_attachments", force: :cascade do |t| @@ -37,7 +36,7 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "record_type", null: false t.bigint "record_id", null: false t.bigint "blob_id", null: false - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end @@ -48,8 +47,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "content_type" t.text "metadata" t.bigint "byte_size", null: false - t.string "checksum", null: false - t.datetime "created_at", null: false + t.string "checksum" + t.datetime "created_at", precision: nil, null: false t.string "service_name", null: false t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end @@ -65,8 +64,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "action" t.string "actionable_type" t.integer "actionable_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["actionable_id", "actionable_type"], name: "index_activities_on_actionable_id_and_actionable_type" t.index ["user_id"], name: "index_activities_on_user_id" end @@ -74,8 +73,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "admin_notification_translations", id: :serial, force: :cascade do |t| t.integer "admin_notification_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.text "body" t.index ["admin_notification_id"], name: "index_admin_notification_translations_on_admin_notification_id" @@ -87,8 +86,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "segment_recipient" t.integer "recipients_count" t.date "sent_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "administrators", id: :serial, force: :cascade do |t| @@ -102,7 +101,7 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "user_id" t.string "name" t.jsonb "properties" - t.datetime "time" + t.datetime "time", precision: nil t.string "ip" t.index ["name", "time"], name: "index_ahoy_events_on_name_and_time" t.index ["time"], name: "index_ahoy_events_on_time" @@ -124,7 +123,7 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "comment" t.string "remote_address" t.string "request_uuid" - t.datetime "created_at" + t.datetime "created_at", precision: nil t.index ["associated_type", "associated_id"], name: "associated_index" t.index ["auditable_type", "auditable_id", "version"], name: "auditable_index" t.index ["created_at"], name: "index_audits_on_created_at" @@ -135,18 +134,18 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "banner_sections", id: :serial, force: :cascade do |t| t.integer "banner_id" t.integer "web_section_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "banner_translations", id: :serial, force: :cascade do |t| t.integer "banner_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.text "description" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["banner_id"], name: "index_banner_translations_on_banner_id" t.index ["hidden_at"], name: "index_banner_translations_on_hidden_at" t.index ["locale"], name: "index_banner_translations_on_locale" @@ -156,9 +155,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "target_url" t.date "post_started_at" t.date "post_ended_at" - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "hidden_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.text "background_color" t.text "font_color" t.index ["hidden_at"], name: "index_banners_on_hidden_at" @@ -167,8 +166,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "budget_administrators", id: :serial, force: :cascade do |t| t.integer "budget_id" t.integer "administrator_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["administrator_id"], name: "index_budget_administrators_on_administrator_id" t.index ["budget_id"], name: "index_budget_administrators_on_budget_id" end @@ -176,8 +175,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "budget_ballot_lines", id: :serial, force: :cascade do |t| t.integer "ballot_id" t.integer "investment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "budget_id" t.integer "group_id" t.integer "heading_id" @@ -192,8 +191,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "budget_ballots", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "budget_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "ballot_lines_count", default: 0 t.boolean "physical", default: false t.integer "poll_ballot_id" @@ -203,16 +202,16 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "heading_id" t.text "body" t.string "locale" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["heading_id"], name: "index_budget_content_blocks_on_heading_id" end create_table "budget_group_translations", id: :serial, force: :cascade do |t| t.integer "budget_group_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "name" t.index ["budget_group_id"], name: "index_budget_group_translations_on_budget_group_id" t.index ["locale"], name: "index_budget_group_translations_on_locale" @@ -222,16 +221,16 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "budget_id" t.string "slug" t.integer "max_votable_headings", default: 1 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["budget_id"], name: "index_budget_groups_on_budget_id" end create_table "budget_heading_translations", id: :serial, force: :cascade do |t| t.integer "budget_heading_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "name" t.index ["budget_heading_id"], name: "index_budget_heading_translations_on_budget_heading_id" t.index ["locale"], name: "index_budget_heading_translations_on_locale" @@ -247,8 +246,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.text "longitude" t.integer "geozone_id" t.integer "max_ballot_lines", default: 1 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["geozone_id"], name: "index_budget_headings_on_geozone_id" t.index ["group_id"], name: "index_budget_headings_on_group_id" end @@ -256,11 +255,11 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "budget_investment_translations", id: :serial, force: :cascade do |t| t.integer "budget_investment_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.text "description" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["budget_investment_id"], name: "index_budget_investment_translations_on_budget_investment_id" t.index ["hidden_at"], name: "index_budget_investment_translations_on_hidden_at" t.index ["locale"], name: "index_budget_investment_translations_on_locale" @@ -278,14 +277,14 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "valuator_assignments_count", default: 0 t.bigint "price_first_year" t.string "duration" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.integer "cached_votes_up", default: 0 t.integer "comments_count", default: 0 t.integer "confidence_score", default: 0, null: false t.integer "physical_votes", default: 0 t.tsvector "tsv" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "heading_id" t.string "responsible_name" t.integer "budget_id" @@ -293,7 +292,7 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.boolean "selected", default: false t.string "location" t.string "organization_name" - t.datetime "unfeasible_email_sent_at" + t.datetime "unfeasible_email_sent_at", precision: nil t.integer "ballot_lines_count", default: 0 t.integer "previous_heading_id" t.boolean "winner", default: false @@ -301,8 +300,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "community_id" t.boolean "visible_to_valuators", default: false t.integer "valuator_group_assignments_count", default: 0 - t.datetime "confirmed_hide_at" - t.datetime "ignored_flag_at" + t.datetime "confirmed_hide_at", precision: nil + t.datetime "ignored_flag_at", precision: nil t.integer "flags_count", default: 0 t.integer "original_heading_id" t.index ["administrator_id"], name: "index_budget_investments_on_administrator_id" @@ -319,8 +318,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "budget_phase_translations", id: :serial, force: :cascade do |t| t.integer "budget_phase_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.text "description" t.text "summary" t.string "name" @@ -334,8 +333,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "budget_id" t.integer "next_phase_id" t.string "kind", null: false - t.datetime "starts_at" - t.datetime "ends_at" + t.datetime "starts_at", precision: nil + t.datetime "ends_at", precision: nil t.boolean "enabled", default: true t.index ["ends_at"], name: "index_budget_phases_on_ends_at" t.index ["kind"], name: "index_budget_phases_on_kind" @@ -347,15 +346,15 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "user_id" t.integer "investment_id" t.string "reason" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "budget_translations", id: :serial, force: :cascade do |t| t.integer "budget_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "name" t.string "main_link_text" t.string "main_link_url" @@ -366,8 +365,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "budget_valuator_assignments", id: :serial, force: :cascade do |t| t.integer "valuator_id" t.integer "investment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["investment_id"], name: "index_budget_valuator_assignments_on_investment_id" end @@ -379,8 +378,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "budget_valuators", id: :serial, force: :cascade do |t| t.integer "budget_id" t.integer "valuator_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["budget_id"], name: "index_budget_valuators_on_budget_id" t.index ["valuator_id"], name: "index_budget_valuators_on_valuator_id" end @@ -388,8 +387,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "budgets", id: :serial, force: :cascade do |t| t.string "currency_symbol", limit: 10 t.string "phase", limit: 40, default: "accepting" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.text "description_accepting" t.text "description_reviewing" t.text "description_selecting" @@ -409,8 +408,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "campaigns", id: :serial, force: :cascade do |t| t.string "name" t.string "track_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "ckeditor_assets", id: :serial, force: :cascade do |t| @@ -421,18 +420,18 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "type", limit: 30 t.integer "width" t.integer "height" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["type"], name: "index_ckeditor_assets_on_type" end create_table "comment_translations", id: :serial, force: :cascade do |t| t.integer "comment_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.text "body" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["comment_id"], name: "index_comment_translations_on_comment_id" t.index ["hidden_at"], name: "index_comment_translations_on_hidden_at" t.index ["locale"], name: "index_comment_translations_on_locale" @@ -443,17 +442,17 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "commentable_type" t.string "subject" t.integer "user_id", null: false - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "hidden_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil + t.datetime "hidden_at", precision: nil t.integer "flags_count", default: 0 - t.datetime "ignored_flag_at" + t.datetime "ignored_flag_at", precision: nil t.integer "moderator_id" t.integer "administrator_id" t.integer "cached_votes_total", default: 0 t.integer "cached_votes_up", default: 0 t.integer "cached_votes_down", default: 0 - t.datetime "confirmed_hide_at" + t.datetime "confirmed_hide_at", precision: nil t.string "ancestry" t.integer "confidence_score", default: 0, null: false t.boolean "valuation", default: false @@ -471,8 +470,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do end create_table "communities", id: :serial, force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "dashboard_actions", id: :serial, force: :cascade do |t| @@ -483,11 +482,11 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "required_supports", default: 0 t.integer "order", default: 0 t.boolean "active", default: true - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.integer "action_type", default: 0, null: false t.string "short_description" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "published_proposal", default: false end @@ -495,9 +494,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "source_type" t.integer "source_id" t.integer "user_id" - t.datetime "executed_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "executed_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["source_type", "source_id"], name: "index_dashboard_administrator_tasks_on_source" t.index ["user_id"], name: "index_dashboard_administrator_tasks_on_user_id" end @@ -505,9 +504,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "dashboard_executed_actions", id: :serial, force: :cascade do |t| t.integer "proposal_id" t.integer "action_id" - t.datetime "executed_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "executed_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["action_id"], name: "index_proposal_action" t.index ["proposal_id"], name: "index_dashboard_executed_actions_on_proposal_id" end @@ -515,11 +514,11 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "debate_translations", id: :serial, force: :cascade do |t| t.integer "debate_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.text "description" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["debate_id"], name: "index_debate_translations_on_debate_id" t.index ["hidden_at"], name: "index_debate_translations_on_hidden_at" t.index ["locale"], name: "index_debate_translations_on_locale" @@ -527,24 +526,24 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "debates", id: :serial, force: :cascade do |t| t.integer "author_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "visit_id" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.integer "flags_count", default: 0 - t.datetime "ignored_flag_at" + t.datetime "ignored_flag_at", precision: nil t.integer "cached_votes_total", default: 0 t.integer "cached_votes_up", default: 0 t.integer "cached_votes_down", default: 0 t.integer "comments_count", default: 0 - t.datetime "confirmed_hide_at" + t.datetime "confirmed_hide_at", precision: nil t.integer "cached_anonymous_votes_total", default: 0 t.integer "cached_votes_score", default: 0 t.bigint "hot_score", default: 0 t.integer "confidence_score", default: 0 t.integer "geozone_id" t.tsvector "tsv" - t.datetime "featured_at" + t.datetime "featured_at", precision: nil t.index ["author_id", "hidden_at"], name: "index_debates_on_author_id_and_hidden_at" t.index ["author_id"], name: "index_debates_on_author_id" t.index ["cached_votes_down"], name: "index_debates_on_cached_votes_down" @@ -563,13 +562,13 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "attempts", default: 0, null: false t.text "handler", null: false t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" + t.datetime "run_at", precision: nil + t.datetime "locked_at", precision: nil + t.datetime "failed_at", precision: nil t.string "locked_by" t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "tenant" t.index ["priority", "run_at"], name: "delayed_jobs_priority" end @@ -579,8 +578,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "receiver_id" t.string "title" t.text "body" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "documents", id: :serial, force: :cascade do |t| @@ -588,8 +587,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "user_id" t.string "documentable_type" t.integer "documentable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.boolean "admin", default: false t.index ["documentable_type", "documentable_id"], name: "index_documents_on_documentable_type_and_documentable_id" t.index ["user_id", "documentable_type", "documentable_id"], name: "access_documents" @@ -602,8 +601,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "document_type" t.date "date_of_birth" t.string "postal_code" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "district_code" t.integer "poll_officer_id" t.integer "year_of_birth" @@ -615,8 +614,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "user_id" t.string "flaggable_type" t.integer "flaggable_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["flaggable_type", "flaggable_id"], name: "index_flags_on_flaggable_type_and_flaggable_id" t.index ["user_id", "flaggable_type", "flaggable_id"], name: "access_inappropiate_flags" t.index ["user_id"], name: "index_flags_on_user_id" @@ -626,8 +625,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "user_id" t.string "followable_type" t.integer "followable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["followable_type", "followable_id"], name: "index_follows_on_followable_type_and_followable_id" t.index ["user_id", "followable_type", "followable_id"], name: "access_follows" t.index ["user_id"], name: "index_follows_on_user_id" @@ -637,8 +636,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "name" t.string "html_map_coordinates" t.string "external_code" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "census_code" t.text "geojson" t.string "color" @@ -654,8 +653,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "i18n_content_translations", id: :serial, force: :cascade do |t| t.integer "i18n_content_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.text "value" t.index ["i18n_content_id"], name: "index_i18n_content_translations_on_i18n_content_id" t.index ["locale"], name: "index_i18n_content_translations_on_locale" @@ -669,8 +668,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "user_id" t.string "provider" t.string "uid" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["user_id"], name: "index_identities_on_user_id" end @@ -678,8 +677,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "imageable_type" t.integer "imageable_id" t.string "title", limit: 80 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "user_id" t.index ["imageable_type", "imageable_id"], name: "index_images_on_imageable_type_and_imageable_id" t.index ["user_id"], name: "index_images_on_user_id" @@ -691,9 +690,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.text "text" t.integer "legislation_draft_version_id" t.integer "author_id" - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "hidden_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "comments_count", default: 0 t.string "range_start" t.integer "range_start_offset" @@ -710,9 +709,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "legislation_question_id" t.integer "legislation_question_option_id" t.integer "user_id" - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "hidden_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["hidden_at"], name: "index_legislation_answers_on_hidden_at" t.index ["legislation_question_id"], name: "index_legislation_answers_on_legislation_question_id" t.index ["legislation_question_option_id"], name: "index_legislation_answers_on_legislation_question_option_id" @@ -722,12 +721,12 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "legislation_draft_version_translations", id: :serial, force: :cascade do |t| t.integer "legislation_draft_version_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.text "changelog" t.text "body" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["hidden_at"], name: "index_legislation_draft_version_translations_on_hidden_at" t.index ["legislation_draft_version_id"], name: "index_900e5ba94457606e69e89193db426e8ddff809bc" t.index ["locale"], name: "index_legislation_draft_version_translations_on_locale" @@ -737,9 +736,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "legislation_process_id" t.string "status", default: "draft" t.boolean "final_version", default: false - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "hidden_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["hidden_at"], name: "index_legislation_draft_versions_on_hidden_at" t.index ["legislation_process_id"], name: "index_legislation_draft_versions_on_legislation_process_id" t.index ["status"], name: "index_legislation_draft_versions_on_status" @@ -748,15 +747,15 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "legislation_process_translations", id: :serial, force: :cascade do |t| t.integer "legislation_process_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.text "summary" t.text "description" t.text "additional_info" t.text "milestones_summary" t.text "homepage" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["hidden_at"], name: "index_legislation_process_translations_on_hidden_at" t.index ["legislation_process_id"], name: "index_199e5fed0aca73302243f6a1fca885ce10cdbb55" t.index ["locale"], name: "index_legislation_process_translations_on_locale" @@ -771,9 +770,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.date "allegations_start_date" t.date "allegations_end_date" t.date "result_publication_date" - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "hidden_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.boolean "debate_phase_enabled", default: false t.boolean "allegations_phase_enabled", default: false t.boolean "draft_publication_enabled", default: false @@ -808,12 +807,12 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "title", limit: 80 t.text "description" t.integer "author_id" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.integer "flags_count", default: 0 - t.datetime "ignored_flag_at" + t.datetime "ignored_flag_at", precision: nil t.integer "cached_votes_up", default: 0 t.integer "comments_count", default: 0 - t.datetime "confirmed_hide_at" + t.datetime "confirmed_hide_at", precision: nil t.bigint "hot_score", default: 0 t.integer "confidence_score", default: 0 t.string "responsible_name", limit: 60 @@ -821,12 +820,12 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "video_url" t.tsvector "tsv" t.integer "geozone_id" - t.datetime "retired_at" + t.datetime "retired_at", precision: nil t.string "retired_reason" t.text "retired_explanation" t.integer "community_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "cached_votes_total", default: 0 t.integer "cached_votes_down", default: 0 t.boolean "selected" @@ -838,10 +837,10 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "legislation_question_option_translations", id: :serial, force: :cascade do |t| t.integer "legislation_question_option_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "value" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["hidden_at"], name: "index_legislation_question_option_translations_on_hidden_at" t.index ["legislation_question_option_id"], name: "index_61bcec8729110b7f8e1e9e5ce08780878597a209" t.index ["locale"], name: "index_legislation_question_option_translations_on_locale" @@ -850,9 +849,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "legislation_question_options", id: :serial, force: :cascade do |t| t.integer "legislation_question_id" t.integer "answers_count", default: 0 - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "hidden_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["hidden_at"], name: "index_legislation_question_options_on_hidden_at" t.index ["legislation_question_id"], name: "index_legislation_question_options_on_legislation_question_id" end @@ -860,10 +859,10 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "legislation_question_translations", id: :serial, force: :cascade do |t| t.integer "legislation_question_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.text "title" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.text "description" t.index ["hidden_at"], name: "index_legislation_question_translations_on_hidden_at" t.index ["legislation_question_id"], name: "index_d34cc1e1fe6d5162210c41ce56533c5afabcdbd3" @@ -873,9 +872,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "legislation_questions", id: :serial, force: :cascade do |t| t.integer "legislation_process_id" t.integer "answers_count", default: 0 - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "hidden_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "comments_count", default: 0 t.integer "author_id" t.index ["hidden_at"], name: "index_legislation_questions_on_hidden_at" @@ -887,8 +886,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "url" t.string "linkable_type" t.integer "linkable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["linkable_type", "linkable_id"], name: "index_links_on_linkable_type_and_linkable_id" end @@ -897,8 +896,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "document_type", null: false t.date "date_of_birth", null: false t.string "postal_code", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["document_number", "document_type"], name: "index_local_census_records_on_document_number_and_document_type", unique: true t.index ["document_number"], name: "index_local_census_records_on_document_number" end @@ -906,29 +905,29 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "locks", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "tries", default: 0 - t.datetime "locked_until", default: "2000-01-01 01:01:01", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "locked_until", precision: nil, default: "2000-01-01 01:01:01", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["user_id"], name: "index_locks_on_user_id" end create_table "machine_learning_infos", force: :cascade do |t| t.string "kind" - t.datetime "generated_at" + t.datetime "generated_at", precision: nil t.string "script" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "machine_learning_jobs", force: :cascade do |t| - t.datetime "started_at" - t.datetime "finished_at" + t.datetime "started_at", precision: nil + t.datetime "finished_at", precision: nil t.string "script" t.integer "pid" t.string "error" t.bigint "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["user_id"], name: "index_machine_learning_jobs_on_user_id" end @@ -950,17 +949,17 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "milestone_statuses", id: :serial, force: :cascade do |t| t.string "name" t.text "description" - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "hidden_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["hidden_at"], name: "index_milestone_statuses_on_hidden_at" end create_table "milestone_translations", id: :serial, force: :cascade do |t| t.integer "milestone_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.text "description" t.index ["locale"], name: "index_milestone_translations_on_locale" @@ -970,10 +969,10 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "milestones", id: :serial, force: :cascade do |t| t.string "milestoneable_type" t.integer "milestoneable_id" - t.datetime "publication_date" + t.datetime "publication_date", precision: nil t.integer "status_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["status_id"], name: "index_milestones_on_status_id" end @@ -981,8 +980,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "commentable_id" t.string "commentable_type" t.text "body" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "moderators", id: :serial, force: :cascade do |t| @@ -996,9 +995,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "from" t.text "body" t.date "sent_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "hidden_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + t.datetime "hidden_at", precision: nil end create_table "notifications", id: :serial, force: :cascade do |t| @@ -1006,16 +1005,16 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "notifiable_type" t.integer "notifiable_id" t.integer "counter", default: 1 - t.datetime "emailed_at" - t.datetime "read_at" + t.datetime "emailed_at", precision: nil + t.datetime "read_at", precision: nil t.index ["user_id"], name: "index_notifications_on_user_id" end create_table "organizations", id: :serial, force: :cascade do |t| t.integer "user_id" t.string "name", limit: 60 - t.datetime "verified_at" - t.datetime "rejected_at" + t.datetime "verified_at", precision: nil + t.datetime "rejected_at", precision: nil t.string "responsible_name", limit: 60 t.index ["user_id"], name: "index_organizations_on_user_id" end @@ -1024,8 +1023,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "question_id" t.integer "author_id" t.string "answer" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["author_id"], name: "index_poll_answers_on_author_id" t.index ["question_id", "answer"], name: "index_poll_answers_on_question_id_and_answer" t.index ["question_id"], name: "index_poll_answers_on_question_id" @@ -1035,8 +1034,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.text "data" t.integer "poll_id" t.integer "officer_assignment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["officer_assignment_id"], name: "index_poll_ballot_sheets_on_officer_assignment_id" t.index ["poll_id"], name: "index_poll_ballot_sheets_on_poll_id" end @@ -1045,15 +1044,15 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "ballot_sheet_id" t.text "data" t.integer "external_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "poll_booth_assignments", id: :serial, force: :cascade do |t| t.integer "booth_id" t.integer "poll_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["booth_id"], name: "index_poll_booth_assignments_on_booth_id" t.index ["poll_id"], name: "index_poll_booth_assignments_on_poll_id" end @@ -1066,8 +1065,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "poll_officer_assignments", id: :serial, force: :cascade do |t| t.integer "booth_assignment_id" t.integer "officer_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.date "date", null: false t.boolean "final", default: false t.string "user_data_log", default: "" @@ -1103,8 +1102,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "poll_question_answer_translations", id: :serial, force: :cascade do |t| t.integer "poll_question_answer_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.text "description" t.index ["locale"], name: "index_poll_question_answer_translations_on_locale" @@ -1128,10 +1127,10 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "poll_question_translations", id: :serial, force: :cascade do |t| t.integer "poll_question_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["hidden_at"], name: "index_poll_question_translations_on_hidden_at" t.index ["locale"], name: "index_poll_question_translations_on_locale" t.index ["poll_question_id"], name: "index_poll_question_translations_on_poll_question_id" @@ -1143,9 +1142,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "author_id" t.string "author_visible_name" t.integer "comments_count" - t.datetime "hidden_at" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "hidden_at", precision: nil + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.tsvector "tsv" t.string "video_url" t.index ["author_id"], name: "index_poll_questions_on_author_id" @@ -1176,8 +1175,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "booth_id" t.integer "officer_id" t.date "date" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "officer_name" t.string "officer_email" t.integer "task", default: 0, null: false @@ -1189,12 +1188,12 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "poll_translations", id: :serial, force: :cascade do |t| t.integer "poll_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "name" t.text "summary" t.text "description" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["hidden_at"], name: "index_poll_translations_on_hidden_at" t.index ["locale"], name: "index_poll_translations_on_locale" t.index ["poll_id"], name: "index_poll_translations_on_poll_id" @@ -1203,8 +1202,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "poll_voters", id: :serial, force: :cascade do |t| t.string "document_number" t.string "document_type" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "poll_id", null: false t.integer "booth_assignment_id" t.integer "age" @@ -1224,16 +1223,16 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do end create_table "polls", id: :serial, force: :cascade do |t| - t.datetime "starts_at" - t.datetime "ends_at" + t.datetime "starts_at", precision: nil + t.datetime "ends_at", precision: nil t.boolean "published", default: false t.boolean "geozone_restricted", default: false t.integer "comments_count", default: 0 t.integer "author_id" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.string "slug" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "budget_id" t.string "related_type" t.integer "related_id" @@ -1247,8 +1246,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "progress_bar_translations", id: :serial, force: :cascade do |t| t.integer "progress_bar_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.index ["locale"], name: "index_progress_bar_translations_on_locale" t.index ["progress_bar_id"], name: "index_progress_bar_translations_on_progress_bar_id" @@ -1259,8 +1258,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "percentage" t.string "progressable_type" t.integer "progressable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "proposal_notifications", id: :serial, force: :cascade do |t| @@ -1268,12 +1267,12 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.text "body" t.integer "author_id" t.integer "proposal_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.boolean "moderated", default: false - t.datetime "hidden_at" - t.datetime "ignored_at" - t.datetime "confirmed_hide_at" + t.datetime "hidden_at", precision: nil + t.datetime "ignored_at", precision: nil + t.datetime "confirmed_hide_at", precision: nil t.tsvector "tsv" t.index ["tsv"], name: "index_proposal_notifications_on_tsv", using: :gin end @@ -1281,13 +1280,13 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "proposal_translations", id: :serial, force: :cascade do |t| t.integer "proposal_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.text "description" t.text "summary" t.text "retired_explanation" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["hidden_at"], name: "index_proposal_translations_on_hidden_at" t.index ["locale"], name: "index_proposal_translations_on_locale" t.index ["proposal_id"], name: "index_proposal_translations_on_proposal_id" @@ -1295,24 +1294,24 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "proposals", id: :serial, force: :cascade do |t| t.integer "author_id" - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.integer "flags_count", default: 0 - t.datetime "ignored_flag_at" + t.datetime "ignored_flag_at", precision: nil t.integer "cached_votes_up", default: 0 t.integer "comments_count", default: 0 - t.datetime "confirmed_hide_at" + t.datetime "confirmed_hide_at", precision: nil t.bigint "hot_score", default: 0 t.integer "confidence_score", default: 0 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "responsible_name", limit: 60 t.string "video_url" t.tsvector "tsv" t.integer "geozone_id" - t.datetime "retired_at" + t.datetime "retired_at", precision: nil t.string "retired_reason" t.integer "community_id" - t.datetime "published_at" + t.datetime "published_at", precision: nil t.boolean "selected", default: false t.index ["author_id", "hidden_at"], name: "index_proposals_on_author_id_and_hidden_at" t.index ["author_id"], name: "index_proposals_on_author_id" @@ -1341,9 +1340,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "child_relationable_type" t.integer "child_relationable_id" t.integer "related_content_id" - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "hidden_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil + t.datetime "hidden_at", precision: nil t.integer "related_content_scores_count", default: 0 t.integer "author_id" t.boolean "machine_learning", default: false @@ -1360,8 +1359,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "remote_translatable_id" t.string "remote_translatable_type" t.text "error_message" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "reports", id: :serial, force: :cascade do |t| @@ -1369,16 +1368,16 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.boolean "results" t.string "process_type" t.integer "process_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.boolean "advanced_stats" t.index ["process_type", "process_id"], name: "index_reports_on_process_type_and_process_id" end create_table "sdg_goals", force: :cascade do |t| t.integer "code", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["code"], name: "index_sdg_goals_on_code", unique: true end @@ -1387,8 +1386,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "locale", null: false t.string "title" t.text "description" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["locale"], name: "index_sdg_local_target_translations_on_locale" t.index ["sdg_local_target_id"], name: "index_sdg_local_target_translations_on_sdg_local_target_id" end @@ -1396,8 +1395,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "sdg_local_targets", force: :cascade do |t| t.bigint "target_id" t.string "code" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.bigint "goal_id" t.index ["code"], name: "index_sdg_local_targets_on_code", unique: true t.index ["goal_id"], name: "index_sdg_local_targets_on_goal_id" @@ -1406,15 +1405,15 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "sdg_managers", force: :cascade do |t| t.bigint "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["user_id"], name: "index_sdg_managers_on_user_id", unique: true end create_table "sdg_phases", force: :cascade do |t| t.integer "kind", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["kind"], name: "index_sdg_phases_on_kind", unique: true end @@ -1423,8 +1422,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.bigint "related_sdg_id" t.string "relatable_type" t.bigint "relatable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["relatable_type", "relatable_id"], name: "index_sdg_relations_on_relatable_type_and_relatable_id" t.index ["related_sdg_id", "related_sdg_type", "relatable_id", "relatable_type"], name: "sdg_relations_unique", unique: true t.index ["related_sdg_type", "related_sdg_id"], name: "index_sdg_relations_on_related_sdg_type_and_related_sdg_id" @@ -1433,16 +1432,16 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "sdg_reviews", force: :cascade do |t| t.string "relatable_type" t.bigint "relatable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["relatable_type", "relatable_id"], name: "index_sdg_reviews_on_relatable_type_and_relatable_id", unique: true end create_table "sdg_targets", force: :cascade do |t| t.bigint "goal_id" t.string "code", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["code"], name: "index_sdg_targets_on_code", unique: true t.index ["goal_id"], name: "index_sdg_targets_on_goal_id" end @@ -1459,8 +1458,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.text "required_fields_to_verify" t.boolean "processed", default: false t.integer "author_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "title" end @@ -1469,8 +1468,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "user_id" t.string "document_number" t.boolean "verified", default: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.date "date_of_birth" t.string "postal_code" end @@ -1479,8 +1478,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "name" t.string "locale" t.text "body" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["name", "locale"], name: "index_site_customization_content_blocks_on_name_and_locale", unique: true end @@ -1489,17 +1488,17 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "image_file_name" t.string "image_content_type" t.bigint "image_file_size" - t.datetime "image_updated_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "image_updated_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["name"], name: "index_site_customization_images_on_name", unique: true end create_table "site_customization_page_translations", id: :serial, force: :cascade do |t| t.integer "site_customization_page_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "title" t.string "subtitle" t.text "content" @@ -1512,16 +1511,16 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.boolean "more_info_flag" t.boolean "print_content_flag" t.string "status", default: "draft" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "locale" end create_table "stats_versions", id: :serial, force: :cascade do |t| t.string "process_type" t.integer "process_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["process_type", "process_id"], name: "index_stats_versions_on_process_type_and_process_id" end @@ -1532,7 +1531,7 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "tagger_type" t.integer "tagger_id" t.string "context", limit: 128 - t.datetime "created_at" + t.datetime "created_at", precision: nil t.index ["context"], name: "index_taggings_on_context" t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true t.index ["tag_id"], name: "index_taggings_on_tag_id" @@ -1563,10 +1562,10 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "tenants", id: :serial, force: :cascade do |t| t.string "name" t.string "schema" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "schema_type", default: 0, null: false - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.index ["name"], name: "index_tenants_on_name", unique: true t.index ["schema"], name: "index_tenants_on_schema", unique: true end @@ -1577,9 +1576,9 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "author_id" t.integer "comments_count", default: 0 t.integer "community_id" - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "hidden_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["community_id"], name: "index_topics_on_community_id" t.index ["hidden_at"], name: "index_topics_on_hidden_at" end @@ -1588,41 +1587,41 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "email", default: "" t.string "encrypted_password", default: "", null: false t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" + t.datetime "reset_password_sent_at", precision: nil + t.datetime "remember_created_at", precision: nil t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" + t.datetime "current_sign_in_at", precision: nil + t.datetime "last_sign_in_at", precision: nil t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "confirmation_token" - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" + t.datetime "confirmed_at", precision: nil + t.datetime "confirmation_sent_at", precision: nil t.string "unconfirmed_email" t.boolean "email_on_comment", default: false t.boolean "email_on_comment_reply", default: false t.string "phone_number", limit: 30 t.string "official_position" t.integer "official_level", default: 0 - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.string "sms_confirmation_code" t.string "username", limit: 60 t.string "document_number" t.string "document_type" - t.datetime "residence_verified_at" + t.datetime "residence_verified_at", precision: nil t.string "email_verification_token" - t.datetime "verified_at" + t.datetime "verified_at", precision: nil t.string "unconfirmed_phone" t.string "confirmed_phone" - t.datetime "letter_requested_at" - t.datetime "confirmed_hide_at" + t.datetime "letter_requested_at", precision: nil + t.datetime "confirmed_hide_at", precision: nil t.string "letter_verification_code" t.integer "failed_census_calls_count", default: 0 - t.datetime "level_two_verified_at" + t.datetime "level_two_verified_at", precision: nil t.string "erase_reason" - t.datetime "erased_at" + t.datetime "erased_at", precision: nil t.boolean "public_activity", default: true t.boolean "newsletter", default: true t.integer "notifications_count", default: 0 @@ -1632,11 +1631,11 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.integer "geozone_id" t.string "redeemable_code" t.string "gender", limit: 10 - t.datetime "date_of_birth" + t.datetime "date_of_birth", precision: nil t.boolean "email_digest", default: true t.boolean "email_on_direct_message", default: true t.boolean "official_position_badge", default: false - t.datetime "password_changed_at", default: "2015-01-01 01:01:01", null: false + t.datetime "password_changed_at", precision: nil, default: "2015-01-01 01:01:01", null: false t.boolean "created_from_signature", default: false t.integer "failed_email_digests_count", default: 0 t.text "former_users_data_log", default: "" @@ -1645,7 +1644,7 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.boolean "recommended_proposals", default: true t.string "subscriptions_token" t.integer "failed_attempts", default: 0, null: false - t.datetime "locked_at" + t.datetime "locked_at", precision: nil t.string "unlock_token" t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["date_of_birth"], name: "index_users_on_date_of_birth" @@ -1679,8 +1678,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "document_type" t.string "phone" t.string "email" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["document_number"], name: "index_verified_users_on_document_number" t.index ["email"], name: "index_verified_users_on_email" t.index ["phone"], name: "index_verified_users_on_phone" @@ -1711,7 +1710,7 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "utm_term" t.string "utm_content" t.string "utm_campaign" - t.datetime "started_at" + t.datetime "started_at", precision: nil t.index ["started_at"], name: "index_visits_on_started_at" t.index ["user_id"], name: "index_visits_on_user_id" end @@ -1721,8 +1720,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.string "questionable_type" t.integer "vote_type" t.integer "max_votes" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "votes", id: :serial, force: :cascade do |t| @@ -1733,8 +1732,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do t.boolean "vote_flag" t.string "vote_scope" t.integer "vote_weight" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "signature_id" t.index ["signature_id"], name: "index_votes_on_signature_id" t.index ["votable_id", "votable_type", "vote_scope"], name: "index_votes_on_votable_id_and_votable_type_and_vote_scope" @@ -1743,15 +1742,15 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "web_sections", id: :serial, force: :cascade do |t| t.text "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "widget_card_translations", id: :serial, force: :cascade do |t| t.integer "widget_card_id", null: false t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "label" t.string "title" t.text "description" @@ -1763,8 +1762,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "widget_cards", id: :serial, force: :cascade do |t| t.string "link_url" t.boolean "header", default: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "cardable_id" t.integer "columns", default: 4 t.string "cardable_type", default: "SiteCustomization::Page" @@ -1775,8 +1774,8 @@ ActiveRecord::Schema.define(version: 2023_10_12_141318) do create_table "widget_feeds", id: :serial, force: :cascade do |t| t.string "kind" t.integer "limit", default: 3 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" diff --git a/spec/controllers/remote_translations_controller_spec.rb b/spec/controllers/remote_translations_controller_spec.rb index e7685f46e..9832607e5 100644 --- a/spec/controllers/remote_translations_controller_spec.rb +++ b/spec/controllers/remote_translations_controller_spec.rb @@ -11,7 +11,7 @@ describe RemoteTranslationsController, :remote_translations do end before do - request.env["HTTP_REFERER"] = "any_path" + request.env["HTTP_REFERER"] = "/any_path" end it "create correctly remote translation" do @@ -39,7 +39,7 @@ describe RemoteTranslationsController, :remote_translations do it "redirect_to request referer after create" do post :create, params: { remote_translations: remote_translations_params } - expect(subject).to redirect_to("any_path") + expect(subject).to redirect_to "/any_path" end end end diff --git a/spec/models/sdg/phase_spec.rb b/spec/models/sdg/phase_spec.rb index 160d09c25..35d4ae817 100644 --- a/spec/models/sdg/phase_spec.rb +++ b/spec/models/sdg/phase_spec.rb @@ -38,7 +38,7 @@ describe SDG::Phase do end it "raises an exception for non-existing kinds" do - expect { SDG::Phase["improvement"] }.to raise_exception ActiveRecord::StatementInvalid + expect { SDG::Phase["improvement"] }.to raise_exception ActiveRecord::RecordNotFound end end end diff --git a/spec/system/site_customization/images_spec.rb b/spec/system/site_customization/images_spec.rb index 4674eaf1d..d7634d75d 100644 --- a/spec/system/site_customization/images_spec.rb +++ b/spec/system/site_customization/images_spec.rb @@ -6,7 +6,7 @@ describe "Site customization images" do visit root_path - expect(page).to have_css("link[rel='shortcut icon'][href$='favicon_custom.ico']", visible: :hidden) + expect(page).to have_css("link[rel='icon'][href$='favicon_custom.ico']", visible: :hidden) end scenario "Custom auth background" do