diff --git a/.rubocop.yml b/.rubocop.yml
index 928b486f..7204f4e7 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,2 +1,10 @@
inherit_gem:
decidim-dev: rubocop-decidim.yml
+
+AllCops:
+ Exclude:
+ - 'db/**/*'
+
+RSpec/DescribeClass:
+ Exclude:
+ - 'spec/system/**/*'
diff --git a/Gemfile b/Gemfile
index b2daf782..91fbfbd0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -17,9 +17,9 @@ gem "decidim-term_customizer", github: "mainio/decidim-module-term_customizer",
gem "bootsnap", "~> 1.7"
gem "deepl-rb", require: "deepl"
gem "deface"
+gem "health_check"
gem "puma"
gem "wicked_pdf", "~> 2.1"
-gem "health_check"
group :development, :test do
gem "byebug", "~> 11.0", platform: :mri
diff --git a/Gemfile.lock b/Gemfile.lock
index 227449bb..71549a1f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -429,16 +429,7 @@ GEM
logger
faraday-net_http (3.3.0)
net-http
- ffi (1.17.0-aarch64-linux-gnu)
- ffi (1.17.0-aarch64-linux-musl)
- ffi (1.17.0-arm-linux-gnu)
- ffi (1.17.0-arm-linux-musl)
- ffi (1.17.0-arm64-darwin)
- ffi (1.17.0-x86-linux-gnu)
- ffi (1.17.0-x86-linux-musl)
- ffi (1.17.0-x86_64-darwin)
- ffi (1.17.0-x86_64-linux-gnu)
- ffi (1.17.0-x86_64-linux-musl)
+ ffi (1.17.0)
file_validators (3.0.0)
activemodel (>= 3.2)
mime-types (>= 1.0)
@@ -761,27 +752,20 @@ GEM
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
- rubocop-ast (1.32.3)
- parser (>= 3.3.1.0)
- rubocop-capybara (2.21.0)
- rubocop (~> 1.41)
- rubocop-factory_bot (2.26.0)
+ rubocop-ast (1.28.1)
+ parser (>= 3.2.1.0)
+ rubocop-capybara (2.18.0)
rubocop (~> 1.41)
rubocop-faker (1.1.0)
faker (>= 2.12.0)
rubocop (>= 0.82.0)
- rubocop-rails (2.25.1)
+ rubocop-rails (2.19.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
- rubocop-ast (>= 1.31.1, < 2.0)
- rubocop-rspec (2.31.0)
- rubocop (~> 1.40)
+ rubocop-rspec (2.20.0)
+ rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
- rubocop-factory_bot (~> 2.22)
- rubocop-rspec_rails (~> 2.28)
- rubocop-rspec_rails (2.29.0)
- rubocop (~> 1.40)
ruby-progressbar (1.13.0)
ruby-vips (2.2.2)
ffi (~> 1.12)
diff --git a/app/controllers/concerns/invites_controller_override.rb b/app/controllers/concerns/invites_controller_override.rb
index 2c06c9b2..8f4ed733 100644
--- a/app/controllers/concerns/invites_controller_override.rb
+++ b/app/controllers/concerns/invites_controller_override.rb
@@ -5,7 +5,7 @@ module InvitesControllerOverride
extend ActiveSupport::Concern
included do
- before_action :ensure_external_invites_allowed, only: :create
+ before_action :ensure_external_invites_allowed, only: :create # rubocop:disable Rails/LexicallyScopedActionFilter:
def ensure_external_invites_allowed
return unless Rails.application.secrets.dig(:gpc, :disable_external_invites)
diff --git a/app/controllers/concerns/omniauth_registrations_controller_override.rb b/app/controllers/concerns/omniauth_registrations_controller_override.rb
index f3d553b6..29e888c2 100644
--- a/app/controllers/concerns/omniauth_registrations_controller_override.rb
+++ b/app/controllers/concerns/omniauth_registrations_controller_override.rb
@@ -5,7 +5,7 @@ module OmniauthRegistrationsControllerOverride
extend ActiveSupport::Concern
included do
- before_action :ensure_user_exists, only: :google_oauth2
+ before_action :ensure_user_exists, only: :google_oauth2 # rubocop:disable Rails/LexicallyScopedActionFilter:
# if oauth via google is active, we don't want people to register if disabled in system (this is probably a bug in decidim)
def ensure_user_exists
@@ -13,11 +13,11 @@ def ensure_user_exists
@form = form(Decidim::OmniauthRegistrationForm).from_params(form_params)
email = @form.email || verified_email
- return if email.present? && Decidim::User.exists?(email: email, organization: current_organization)
+ return if email.present? && Decidim::User.exists?(email:, organization: current_organization)
# No registration allowed
Rails.logger.info "WARNING: Attempt to register via OAuth: #{email}"
- flash[:alert] = I18n.t("email_not_registered", email: email)
+ flash[:alert] = I18n.t("email_not_registered", email:)
redirect_to decidim.root_path
end
diff --git a/app/controllers/concerns/proposals_controller_override.rb b/app/controllers/concerns/proposals_controller_override.rb
index 12a07de5..e18f1c39 100644
--- a/app/controllers/concerns/proposals_controller_override.rb
+++ b/app/controllers/concerns/proposals_controller_override.rb
@@ -3,22 +3,22 @@
module ProposalsControllerOverride
extend ActiveSupport::Concern
- included do
- before_action only: [:index] do
- session[:proposals_filter_default_type] = params.dig(:filter, :type) if params.dig(:filter, :type).present?
- end
+ # included do
+ # before_action only: [:index] do
+ # session[:proposals_filter_default_type] = params.dig(:filter, :type) if params.dig(:filter, :type).present?
+ # end
- def default_filter_params
- {
- search_text_cont: "",
- with_any_origin: default_filter_origin_params,
- activity: "all",
- with_any_category: default_filter_category_params,
- with_any_state: %w(accepted evaluating state_not_published),
- with_any_scope: default_filter_scope_params,
- related_to: "",
- type: session[:proposals_filter_default_type] || "proposals"
- }
- end
- end
+ # def default_filter_params
+ # {
+ # search_text_cont: "",
+ # with_any_origin: default_filter_origin_params,
+ # activity: "all",
+ # with_any_category: default_filter_category_params,
+ # with_any_state: %w(accepted evaluating state_not_published),
+ # with_any_scope: default_filter_scope_params,
+ # related_to: "",
+ # type: session[:proposals_filter_default_type] || "proposals"
+ # }
+ # end
+ # end
end
diff --git a/app/events/decidim/amendable/ready_accepted_event.rb b/app/events/decidim/amendable/ready_accepted_event.rb
index 1e21fcf7..a64950ab 100644
--- a/app/events/decidim/amendable/ready_accepted_event.rb
+++ b/app/events/decidim/amendable/ready_accepted_event.rb
@@ -1,4 +1,4 @@
-# frozen-string_literal: true
+# frozen_string_literal: true
module Decidim::Amendable
class ReadyAcceptedEvent < Decidim::Amendable::AmendmentBaseEvent
diff --git a/app/events/decidim/amendable/ready_rejected_event.rb b/app/events/decidim/amendable/ready_rejected_event.rb
index 664471fe..cec959ee 100644
--- a/app/events/decidim/amendable/ready_rejected_event.rb
+++ b/app/events/decidim/amendable/ready_rejected_event.rb
@@ -1,4 +1,4 @@
-# frozen-string_literal: true
+# frozen_string_literal: true
module Decidim::Amendable
class ReadyRejectedEvent < Decidim::Amendable::AmendmentBaseEvent
diff --git a/app/helpers/concerns/card_helper_override.rb b/app/helpers/concerns/card_helper_override.rb
index f9631c32..3a520e2c 100644
--- a/app/helpers/concerns/card_helper_override.rb
+++ b/app/helpers/concerns/card_helper_override.rb
@@ -13,7 +13,7 @@ def card_for(model, options = {})
# elsif model.is_a?(Decidim::Meetings::Meeting) && leadership_assembly?(model.try(:participatory_space))
# cell "leadership_meeting_m", model
# else
- cell "decidim/card", model, options
+ cell "decidim/card", model, options
# end
end
end
diff --git a/app/helpers/concerns/layout_helper_override.rb b/app/helpers/concerns/layout_helper_override.rb
index af12ff2a..3c06f366 100644
--- a/app/helpers/concerns/layout_helper_override.rb
+++ b/app/helpers/concerns/layout_helper_override.rb
@@ -12,10 +12,10 @@ def extended_navigation_bar(items, max_items: Rails.application.secrets.gpc[:sub
active_item = items.find { |item| item[:active] }
controller.view_context.render partial: "decidim/shared/extended_navigation_bar", locals: {
- items: items,
- extra_items: extra_items,
- active_item: active_item,
- max_items: max_items
+ items:,
+ extra_items:,
+ active_item:,
+ max_items:
}
end
end
diff --git a/app/overrides/decidim/devise/sessions/new/add_admin_login_button.html.erb.deface b/app/overrides/decidim/devise/sessions/new/add_admin_login_button.html.erb.deface
deleted file mode 100644
index af983df1..00000000
--- a/app/overrides/decidim/devise/sessions/new/add_admin_login_button.html.erb.deface
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
- <%= button_tag t("gpc.login.admin_login"), class: "button expanded hollow", onclick: "$('.login_box').toggleClass('hide');$(this).toggleClass('hollow');" %>
-
diff --git a/app/overrides/decidim/devise/sessions/new/replace_login_box_class.html.erb.deface b/app/overrides/decidim/devise/sessions/new/replace_login_box_class.html.erb.deface
index 32a24343..6519ff3c 100644
--- a/app/overrides/decidim/devise/sessions/new/replace_login_box_class.html.erb.deface
+++ b/app/overrides/decidim/devise/sessions/new/replace_login_box_class.html.erb.deface
@@ -1,2 +1,3 @@
-
+
diff --git a/app/overrides/decidim/devise/shared/_omniauth_buttons/replace_civicrm_button.html.erb.deface b/app/overrides/decidim/devise/shared/_omniauth_buttons/replace_civicrm_button.html.erb.deface
index 00149f92..cad38047 100644
--- a/app/overrides/decidim/devise/shared/_omniauth_buttons/replace_civicrm_button.html.erb.deface
+++ b/app/overrides/decidim/devise/shared/_omniauth_buttons/replace_civicrm_button.html.erb.deface
@@ -1,7 +1,7 @@
-
+
<% if provider == :civicrm %>
<%= t("gpc.login.sign_in_civicrm") %>
<% else %>
- <%= t("devise.shared.links.sign_in_with_provider", provider: normalize_provider_name(provider).titleize) %>
+ <%= normalize_provider_name(provider).titleize %>
<% end %>
diff --git a/app/overrides/decidim/devise/shared/_omniauth_buttons_mini/replace_civirm_buttons.html.erb.deface b/app/overrides/decidim/devise/shared/_omniauth_buttons_mini/replace_civirm_buttons.html.erb.deface
deleted file mode 100644
index 00149f92..00000000
--- a/app/overrides/decidim/devise/shared/_omniauth_buttons_mini/replace_civirm_buttons.html.erb.deface
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-<% if provider == :civicrm %>
- <%= t("gpc.login.sign_in_civicrm") %>
-<% else %>
- <%= t("devise.shared.links.sign_in_with_provider", provider: normalize_provider_name(provider).titleize) %>
-<% end %>
diff --git a/app/overrides/decidim/shared/_login_modal/add_admin_login_button.html.erb.deface b/app/overrides/decidim/shared/_login_modal/add_admin_login_button.html.erb.deface
index 327d4911..0fa8b209 100644
--- a/app/overrides/decidim/shared/_login_modal/add_admin_login_button.html.erb.deface
+++ b/app/overrides/decidim/shared/_login_modal/add_admin_login_button.html.erb.deface
@@ -1,7 +1,5 @@
-
+
-
-
- <%= button_tag t("gpc.login.admin_login"), class: "button expanded hollow", onclick: "$('.login_box').toggleClass('hide');$(this).toggleClass('hollow');" %>
-
+
+ <%= button_tag t("gpc.login.admin_login"), type: "button", class: "button button__xs button__transparent-primary", onclick: "$('.login_toggle').toggleClass('!hidden');return false;" %>
diff --git a/app/overrides/decidim/shared/_login_modal/replace_login_box_class.html.erb.deface b/app/overrides/decidim/shared/_login_modal/replace_login_box_class.html.erb.deface
index 0c2ea073..6519ff3c 100644
--- a/app/overrides/decidim/shared/_login_modal/replace_login_box_class.html.erb.deface
+++ b/app/overrides/decidim/shared/_login_modal/replace_login_box_class.html.erb.deface
@@ -1,3 +1,3 @@
-
diff --git a/app/overrides/decidim/shared/_login_modal/replace_login_links_class.html.erb.deface b/app/overrides/decidim/shared/_login_modal/replace_login_links_class.html.erb.deface
new file mode 100644
index 00000000..8841bba2
--- /dev/null
+++ b/app/overrides/decidim/shared/_login_modal/replace_login_links_class.html.erb.deface
@@ -0,0 +1,3 @@
+
diff --git a/app/services/deepl_translator.rb b/app/services/deepl_translator.rb
index 5bea0498..71a91850 100644
--- a/app/services/deepl_translator.rb
+++ b/app/services/deepl_translator.rb
@@ -12,7 +12,7 @@ def initialize(resource, field_name, text, target_locale, source_locale)
end
def translate
- translation = DeepL.translate text, source_locale, target_locale, tag_handling: tag_handling
+ translation = DeepL.translate(text, source_locale, target_locale, tag_handling:)
Decidim::MachineTranslationSaveJob.perform_later(
resource,
diff --git a/app/views/layouts/decidim/_head_extra.html.erb b/app/views/layouts/decidim/_head_extra.html.erb
index b829090a..aa3dd4e5 100644
--- a/app/views/layouts/decidim/_head_extra.html.erb
+++ b/app/views/layouts/decidim/_head_extra.html.erb
@@ -13,4 +13,4 @@
})();
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/bin/rails b/bin/rails
index c8b53385..e4577c49 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
load File.expand_path("spring", __dir__)
APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot"
diff --git a/bin/rake b/bin/rake
index 7327f471..731329ca 100755
--- a/bin/rake
+++ b/bin/rake
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
load File.expand_path("spring", __dir__)
require_relative "../config/boot"
require "rake"
diff --git a/bin/setup b/bin/setup
index ec47b79b..25fe4775 100755
--- a/bin/setup
+++ b/bin/setup
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
require "fileutils"
# path to your application root.
diff --git a/bin/shakapacker b/bin/shakapacker
index abd14d62..0513f209 100755
--- a/bin/shakapacker
+++ b/bin/shakapacker
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
ENV["RAILS_ENV"] ||= "development"
-ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup"
diff --git a/bin/shakapacker-dev-server b/bin/shakapacker-dev-server
index de854184..1416541a 100755
--- a/bin/shakapacker-dev-server
+++ b/bin/shakapacker-dev-server
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
ENV["RAILS_ENV"] ||= "development"
-ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup"
diff --git a/bin/spring b/bin/spring
index a81373ab..48cf68a2 100755
--- a/bin/spring
+++ b/bin/spring
@@ -1,9 +1,10 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
# This file loads Spring without loading other gems in the Gemfile in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
-if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
+if !defined?(Spring) && [nil, "development", "test"].include?(ENV.fetch("RAILS_ENV", nil))
require "bundler"
Bundler.locked_gems.specs.find { |spec| spec.name == "spring" }&.tap do |spring|
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 0b75aab9..f307a93a 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -60,7 +60,6 @@
config.active_record.verbose_query_logs = true
# Suppress logger output for asset requests.
-
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
diff --git a/config/environments/production.rb b/config/environments/production.rb
index eee43c57..4d21d0dd 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -44,11 +44,11 @@
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
- config.ssl_options = { redirect: { exclude: -> request { request.path =~ /health_check/ } } }
+ config.ssl_options = { redirect: { exclude: ->(request) { request.path =~ /health_check/ } } }
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
- config.log_level = %w(debug info warn error fatal).include?(ENV.fetch("RAILS_LOG_LEVEL", nil)) ? ENV["RAILS_LOG_LEVEL"] : :info
+ config.log_level = %w(debug info warn error fatal).include?(ENV.fetch("RAILS_LOG_LEVEL", nil)) ? ENV.fetch("RAILS_LOG_LEVEL", nil) : :info
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
@@ -74,7 +74,7 @@
config.active_support.report_deprecations = false
# Use default logging formatter so that PID and timestamp are not suppressed.
- config.log_formatter = ::Logger::Formatter.new
+ config.log_formatter = Logger::Formatter.new
config.action_mailer.smtp_settings = {
address: Rails.application.secrets.smtp_address,
port: Rails.application.secrets.smtp_port,
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb
index b967720d..b15a372e 100644
--- a/config/initializers/content_security_policy.rb
+++ b/config/initializers/content_security_policy.rb
@@ -1,2 +1,3 @@
+# frozen_string_literal: true
# For tuning the Content Security Policy, check the Decidim documentation site
# https://docs.decidim.org/develop/en/customize/content_security_policy
diff --git a/config/initializers/custom_admin_iframe.rb b/config/initializers/custom_admin_iframe.rb
deleted file mode 100644
index f680b198..00000000
--- a/config/initializers/custom_admin_iframe.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-Decidim.menu :admin_menu do |menu|
- menu.add_item :custom_iframe,
- ENV.fetch("ADMIN_IFRAME_TITLE", "Plausible Stats"),
- Rails.application.routes.url_helpers.admin_iframe_index_path,
- icon_name: "bar-chart-2-line",
- position: 10,
- if: ENV.fetch("ADMIN_IFRAME_URL", nil).present?
-end
diff --git a/config/initializers/date_overrides.rb b/config/initializers/date_overrides.rb
index 66d0e8b3..6ad4f908 100644
--- a/config/initializers/date_overrides.rb
+++ b/config/initializers/date_overrides.rb
@@ -2,7 +2,7 @@
Rails.application.config.to_prepare do
# allow view overrides to use custom helpers
- puts "SKIPPED: Applying date overrides!"
+ Rails.logger.debug "SKIPPED: Applying date overrides!"
# Decidim::CardMCell.include(ApplicationHelper)
# Decidim::DateRangeCell.include(ApplicationHelper)
end
diff --git a/config/initializers/health_check.rb b/config/initializers/health_check.rb
index 83b32e64..ca412a1e 100644
--- a/config/initializers/health_check.rb
+++ b/config/initializers/health_check.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
HealthCheck.setup do |config|
config.standard_checks -= ["emailconf"]
end
diff --git a/config/puma.rb b/config/puma.rb
index 720e7925..520383dc 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -21,10 +21,10 @@
# Specifies the `environment` that Puma will run in.
#
-environment ENV.fetch("RAILS_ENV") { "development" }
+environment ENV.fetch("RAILS_ENV", "development")
# Specifies the `pidfile` that Puma will use.
-pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
+pidfile ENV.fetch("PIDFILE", "tmp/pids/server.pid")
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked web server processes. If using threads and workers together
diff --git a/db/migrate/20201119033352_add_secondary_hosts_to_organizations.decidim.rb b/db/migrate/20201119033352_add_secondary_hosts_to_organizations.decidim.rb
index d9c086f5..f4ab378c 100644
--- a/db/migrate/20201119033352_add_secondary_hosts_to_organizations.decidim.rb
+++ b/db/migrate/20201119033352_add_secondary_hosts_to_organizations.decidim.rb
@@ -3,6 +3,7 @@
class AddSecondaryHostsToOrganizations < ActiveRecord::Migration[5.0]
def change
- add_column :decidim_organizations, :secondary_hosts, :string, array: true, default: [], index: true
+ add_column :decidim_organizations, :secondary_hosts, :string, array: true, default: []
+ add_index :decidim_organizations, :secondary_hosts
end
end
diff --git a/db/migrate/20201119033361_add_hierarchy_to_scopes.decidim.rb b/db/migrate/20201119033361_add_hierarchy_to_scopes.decidim.rb
index 87387cb7..4092994c 100644
--- a/db/migrate/20201119033361_add_hierarchy_to_scopes.decidim.rb
+++ b/db/migrate/20201119033361_add_hierarchy_to_scopes.decidim.rb
@@ -37,7 +37,7 @@ def self.up
name = s["name"].gsub(/'/, "''")
execute("
UPDATE decidim_scopes
- SET name = '#{Hash[locales.map { |locale| [locale, name] }].to_json}',
+ SET name = '#{locales.index_with { |_locale| name }.to_json}',
code = #{quote(s["id"])}
WHERE id = #{s["id"]}
")
diff --git a/db/migrate/20201119033366_add_admin_to_users.decidim.rb b/db/migrate/20201119033366_add_admin_to_users.decidim.rb
index ab8e367f..1f779994 100644
--- a/db/migrate/20201119033366_add_admin_to_users.decidim.rb
+++ b/db/migrate/20201119033366_add_admin_to_users.decidim.rb
@@ -5,7 +5,7 @@ class AddAdminToUsers < ActiveRecord::Migration[5.1]
def up
add_column :decidim_users, :admin, :boolean, null: false, default: false
- execute <<~SQL
+ execute <<~SQL.squish
UPDATE decidim_users
SET admin = true
WHERE roles @> '{admin}'
diff --git a/db/migrate/20201119033404_add_version_to_action_logs.decidim.rb b/db/migrate/20201119033404_add_version_to_action_logs.decidim.rb
index 6db3e158..8efc7fb5 100644
--- a/db/migrate/20201119033404_add_version_to_action_logs.decidim.rb
+++ b/db/migrate/20201119033404_add_version_to_action_logs.decidim.rb
@@ -7,7 +7,8 @@ class ActionLog < ApplicationRecord
end
def up
- add_column :decidim_action_logs, :version_id, :integer, index: true
+ add_column :decidim_action_logs, :version_id, :integer
+ add_index :decidim_action_logs, :version_id
ActionLog.find_each do |action_log|
version_id = action_log.extra.dig("version", "id")
diff --git a/db/migrate/20201119033408_rename_maximum_votes_per_proposal_to_threshold_per_proposal.decidim.rb b/db/migrate/20201119033408_rename_maximum_votes_per_proposal_to_threshold_per_proposal.decidim.rb
index e1a2c6ab..b8cc31a3 100644
--- a/db/migrate/20201119033408_rename_maximum_votes_per_proposal_to_threshold_per_proposal.decidim.rb
+++ b/db/migrate/20201119033408_rename_maximum_votes_per_proposal_to_threshold_per_proposal.decidim.rb
@@ -3,7 +3,7 @@
class RenameMaximumVotesPerProposalToThresholdPerProposal < ActiveRecord::Migration[5.1]
def up
- execute <<~SQL
+ execute <<~SQL.squish
UPDATE decidim_components
SET settings = jsonb_set(
settings::jsonb,
@@ -15,7 +15,7 @@ def up
end
def down
- execute <<~SQL
+ execute <<~SQL.squish
UPDATE decidim_components
SET settings = jsonb_set(
settings::jsonb,
diff --git a/db/migrate/20201119033411_add_tos_version_to_organization.decidim.rb b/db/migrate/20201119033411_add_tos_version_to_organization.decidim.rb
index a166fe89..37b165cf 100644
--- a/db/migrate/20201119033411_add_tos_version_to_organization.decidim.rb
+++ b/db/migrate/20201119033411_add_tos_version_to_organization.decidim.rb
@@ -9,8 +9,8 @@ class Organization < ApplicationRecord
def up
add_column :decidim_organizations, :tos_version, :datetime
Organization.find_each do |organization|
- tos_version = Decidim::StaticPage.find_by(slug: "terms-and-conditions", organization: organization).updated_at
- organization.update(tos_version: tos_version)
+ tos_version = Decidim::StaticPage.find_by(slug: "terms-and-conditions", organization:).updated_at
+ organization.update(tos_version:)
end
end
diff --git a/db/migrate/20201119033412_add_accepted_tos_version_field_to_users.decidim.rb b/db/migrate/20201119033412_add_accepted_tos_version_field_to_users.decidim.rb
index 8115c6c4..36427244 100644
--- a/db/migrate/20201119033412_add_accepted_tos_version_field_to_users.decidim.rb
+++ b/db/migrate/20201119033412_add_accepted_tos_version_field_to_users.decidim.rb
@@ -6,6 +6,7 @@ class Organization < ApplicationRecord
self.table_name = :decidim_organizations
has_many :users, foreign_key: "decidim_organization_id", class_name: "Decidim::User", dependent: :destroy
end
+
class User < ApplicationRecord
self.table_name = :decidim_users
belongs_to :organization, foreign_key: "decidim_organization_id", class_name: "Decidim::Organization"
diff --git a/db/migrate/20201119033422_add_core_content_blocks.decidim.rb b/db/migrate/20201119033422_add_core_content_blocks.decidim.rb
index 095c6588..0a37f7df 100644
--- a/db/migrate/20201119033422_add_core_content_blocks.decidim.rb
+++ b/db/migrate/20201119033422_add_core_content_blocks.decidim.rb
@@ -18,7 +18,7 @@ def change
weight = (index + 1) * 10
ContentBlock.create(
decidim_organization_id: organization_id,
- weight: weight,
+ weight:,
scope: :homepage,
manifest_name: manifest.name,
published_at: Time.current
diff --git a/db/migrate/20201119033426_move_organization_fields_to_hero_content_block.decidim.rb b/db/migrate/20201119033426_move_organization_fields_to_hero_content_block.decidim.rb
index 0bce9045..f73aee32 100644
--- a/db/migrate/20201119033426_move_organization_fields_to_hero_content_block.decidim.rb
+++ b/db/migrate/20201119033426_move_organization_fields_to_hero_content_block.decidim.rb
@@ -14,7 +14,7 @@ class Organization < ApplicationRecord
def change
Decidim::ContentBlock.reset_column_information
Organization.find_each do |organization|
- content_block = Decidim::ContentBlock.find_by(organization: organization, scope: :homepage, manifest_name: :hero)
+ content_block = Decidim::ContentBlock.find_by(organization:, scope: :homepage, manifest_name: :hero)
settings = {}
welcome_text = organization.welcome_text || {}
settings = welcome_text.inject(settings) { |acc, (k, v)| acc.update("welcome_text_#{k}" => v) }
diff --git a/db/migrate/20201119033428_move_users_groups_to_users_table.decidim.rb b/db/migrate/20201119033428_move_users_groups_to_users_table.decidim.rb
index 12288aa6..02a5a38a 100644
--- a/db/migrate/20201119033428_move_users_groups_to_users_table.decidim.rb
+++ b/db/migrate/20201119033428_move_users_groups_to_users_table.decidim.rb
@@ -66,7 +66,7 @@ def change
}
new_attributes = clean_attributes.merge(
nickname: UserBaseEntity.nicknamize(clean_attributes["name"]),
- extended_data: extended_data
+ extended_data:
)
new_user_group = NewUserGroup.create!(new_attributes)
new_ids[old_user_group.id] = new_user_group.id
diff --git a/db/migrate/20201119033435_add_timestamps_to_components.decidim.rb b/db/migrate/20201119033435_add_timestamps_to_components.decidim.rb
index b68fedce..484e0826 100644
--- a/db/migrate/20201119033435_add_timestamps_to_components.decidim.rb
+++ b/db/migrate/20201119033435_add_timestamps_to_components.decidim.rb
@@ -2,10 +2,13 @@
# This migration comes from decidim (originally 20181025082245)
class AddTimestampsToComponents < ActiveRecord::Migration[5.2]
+ class Component < ApplicationRecord
+ self.table_name = :decidim_components
+ end
def change
add_timestamps :decidim_components, null: true
# rubocop:disable Rails/SkipsModelValidations
- Decidim::Component.update_all(created_at: Time.current, updated_at: Time.current)
+ Component.update_all(created_at: Time.current, updated_at: Time.current)
# rubocop:enable Rails/SkipsModelValidations
change_column_null :decidim_components, :created_at, false
change_column_null :decidim_components, :updated_at, false
diff --git a/db/migrate/20201119033438_destroy_deleted_users_follows.decidim.rb b/db/migrate/20201119033438_destroy_deleted_users_follows.decidim.rb
index b697febe..ec65d931 100644
--- a/db/migrate/20201119033438_destroy_deleted_users_follows.decidim.rb
+++ b/db/migrate/20201119033438_destroy_deleted_users_follows.decidim.rb
@@ -5,6 +5,7 @@ class DestroyDeletedUsersFollows < ActiveRecord::Migration[5.2]
class Follow < ApplicationRecord
self.table_name = "decidim_follows"
end
+
class User < ApplicationRecord
self.table_name = "decidim_users"
end
diff --git a/db/migrate/20201119033453_fix_user_names.decidim.rb b/db/migrate/20201119033453_fix_user_names.decidim.rb
index 290182da..4ce9afed 100644
--- a/db/migrate/20201119033453_fix_user_names.decidim.rb
+++ b/db/migrate/20201119033453_fix_user_names.decidim.rb
@@ -9,11 +9,11 @@ def change
characters_to_remove = "<>?%&^*\#@()[]=+:;\"{}\\|/"
weird_characters.each do |character|
- Decidim::UserBaseEntity.where(deleted_at: nil).where("name like '%#{character}%' escape '\' OR nickname like '%#{character}%' escape '\'").find_each do |entity|
- Rails.logger.debug "detected character: #{character}"
- Rails.logger.debug "UserBaseEntity ID: #{entity.id}"
- Rails.logger.debug "#{entity.name} => #{entity.name.delete(characters_to_remove).strip}"
- Rails.logger.debug "#{entity.nickname} => #{entity.nickname.delete(characters_to_remove).strip}"
+ Decidim::UserBaseEntity.where(deleted_at: nil).where("name like '%#{character}%' escape '' OR nickname like '%#{character}%' escape ''").find_each do |entity|
+ Rails.logger.debug { "detected character: #{character}" }
+ Rails.logger.debug { "UserBaseEntity ID: #{entity.id}" }
+ Rails.logger.debug { "#{entity.name} => #{entity.name.delete(characters_to_remove).strip}" }
+ Rails.logger.debug { "#{entity.nickname} => #{entity.nickname.delete(characters_to_remove).strip}" }
entity.name = entity.name.delete(characters_to_remove).strip
sanitized_nickname = entity.nickname.delete(characters_to_remove).strip
diff --git a/db/migrate/20201119033467_index_foreign_keys_in_decidim_action_logs.decidim.rb b/db/migrate/20201119033467_index_foreign_keys_in_decidim_action_logs.decidim.rb
index 4b5641b7..c2171f9c 100644
--- a/db/migrate/20201119033467_index_foreign_keys_in_decidim_action_logs.decidim.rb
+++ b/db/migrate/20201119033467_index_foreign_keys_in_decidim_action_logs.decidim.rb
@@ -5,6 +5,5 @@ class IndexForeignKeysInDecidimActionLogs < ActiveRecord::Migration[5.2]
def change
add_index :decidim_action_logs, :decidim_area_id
add_index :decidim_action_logs, :decidim_scope_id
- add_index :decidim_action_logs, :version_id
end
end
diff --git a/db/migrate/20201119033507_add_promoted_flag_to_processes.decidim_participatory_processes.rb b/db/migrate/20201119033507_add_promoted_flag_to_processes.decidim_participatory_processes.rb
index e8abde11..45ed1a51 100644
--- a/db/migrate/20201119033507_add_promoted_flag_to_processes.decidim_participatory_processes.rb
+++ b/db/migrate/20201119033507_add_promoted_flag_to_processes.decidim_participatory_processes.rb
@@ -3,6 +3,7 @@
class AddPromotedFlagToProcesses < ActiveRecord::Migration[5.0]
def change
- add_column :decidim_participatory_processes, :promoted, :boolean, default: false, index: true
+ add_column :decidim_participatory_processes, :promoted, :boolean, default: false
+ add_index :decidim_participatory_processes, :promoted
end
end
diff --git a/db/migrate/20201119033511_add_published_at_to_processes.decidim_participatory_processes.rb b/db/migrate/20201119033511_add_published_at_to_processes.decidim_participatory_processes.rb
index 4e5cc04e..a8e72afb 100644
--- a/db/migrate/20201119033511_add_published_at_to_processes.decidim_participatory_processes.rb
+++ b/db/migrate/20201119033511_add_published_at_to_processes.decidim_participatory_processes.rb
@@ -3,6 +3,7 @@
class AddPublishedAtToProcesses < ActiveRecord::Migration[5.0]
def change
- add_column :decidim_participatory_processes, :published_at, :datetime, index: true
+ add_column :decidim_participatory_processes, :published_at, :datetime
+ add_index :decidim_participatory_processes, :published_at
end
end
diff --git a/db/migrate/20201119033531_add_attachment_collection_to_attachments.decidim_participatory_processes.rb b/db/migrate/20201119033531_add_attachment_collection_to_attachments.decidim_participatory_processes.rb
index 9edb4644..7f00f168 100644
--- a/db/migrate/20201119033531_add_attachment_collection_to_attachments.decidim_participatory_processes.rb
+++ b/db/migrate/20201119033531_add_attachment_collection_to_attachments.decidim_participatory_processes.rb
@@ -3,7 +3,8 @@
class AddAttachmentCollectionToAttachments < ActiveRecord::Migration[5.1]
def change
- add_column :decidim_attachments, :attachment_collection_id, :integer, null: true, index: { name: "index_decidim_attachments_attachment_collection_id" }
+ add_column :decidim_attachments, :attachment_collection_id, :integer, null: true
+ add_index :decidim_attachments, :attachment_collection_id, name: "index_decidim_attachments_attachment_collection_id"
add_foreign_key :decidim_attachments, :decidim_attachment_collections, column: :attachment_collection_id, on_delete: :nullify,
name: "fk_decidim_attachments_attachment_collection_id"
end
diff --git a/db/migrate/20201119033555_migrate_decidim_assembly_types.decidim_assemblies.rb b/db/migrate/20201119033555_migrate_decidim_assembly_types.decidim_assemblies.rb
index 034d997d..6b5f1018 100644
--- a/db/migrate/20201119033555_migrate_decidim_assembly_types.decidim_assemblies.rb
+++ b/db/migrate/20201119033555_migrate_decidim_assembly_types.decidim_assemblies.rb
@@ -37,7 +37,7 @@ def up
unless type == "others"
assembly_type = AssemblyType.find_or_create_by(
decidim_organization_id: organization.id,
- title: title
+ title:
)
end
Assembly.where(decidim_organization_id: organization.id, assembly_type: type).each do |assembly|
diff --git a/db/migrate/20201119033569_add_user_group_id_to_comments.decidim_comments.rb b/db/migrate/20201119033569_add_user_group_id_to_comments.decidim_comments.rb
index 114f99cf..bff1352a 100644
--- a/db/migrate/20201119033569_add_user_group_id_to_comments.decidim_comments.rb
+++ b/db/migrate/20201119033569_add_user_group_id_to_comments.decidim_comments.rb
@@ -3,6 +3,6 @@
class AddUserGroupIdToComments < ActiveRecord::Migration[5.0]
def change
- add_column :decidim_comments_comments, :decidim_user_group_id, :integer, index: true
+ add_column :decidim_comments_comments, :decidim_user_group_id, :integer
end
end
diff --git a/db/migrate/20201119033574_make_authors_polymorphic_for_comments.decidim_comments.rb b/db/migrate/20201119033574_make_authors_polymorphic_for_comments.decidim_comments.rb
index a414125b..fb3bc2d1 100644
--- a/db/migrate/20201119033574_make_authors_polymorphic_for_comments.decidim_comments.rb
+++ b/db/migrate/20201119033574_make_authors_polymorphic_for_comments.decidim_comments.rb
@@ -5,6 +5,7 @@ class MakeAuthorsPolymorphicForComments < ActiveRecord::Migration[5.2]
class Comment < ApplicationRecord
self.table_name = :decidim_comments_comments
end
+
def change
add_column :decidim_comments_comments, :decidim_author_type, :string
diff --git a/db/migrate/20201119033575_make_author_polymorphic_for_comment_votes.decidim_comments.rb b/db/migrate/20201119033575_make_author_polymorphic_for_comment_votes.decidim_comments.rb
index e12a65c0..9f4dbe6b 100644
--- a/db/migrate/20201119033575_make_author_polymorphic_for_comment_votes.decidim_comments.rb
+++ b/db/migrate/20201119033575_make_author_polymorphic_for_comment_votes.decidim_comments.rb
@@ -5,6 +5,7 @@ class MakeAuthorPolymorphicForCommentVotes < ActiveRecord::Migration[5.2]
class CommentVote < ApplicationRecord
self.table_name = :decidim_comments_comment_votes
end
+
def change
add_column :decidim_comments_comment_votes, :decidim_author_type, :string
diff --git a/db/migrate/20201119033577_make_comments_handle_i18n.decidim_comments.rb b/db/migrate/20201119033577_make_comments_handle_i18n.decidim_comments.rb
index 5ed15664..72263d50 100644
--- a/db/migrate/20201119033577_make_comments_handle_i18n.decidim_comments.rb
+++ b/db/migrate/20201119033577_make_comments_handle_i18n.decidim_comments.rb
@@ -22,7 +22,7 @@ def change
Organization.reset_column_information
Comment.find_each do |comment|
- locale, org_id = User.where(id: comment.decidim_author_id).pluck(:locale, :decidim_organization_id).first
+ locale, org_id = User.where(id: comment.decidim_author_id).pick(:locale, :decidim_organization_id)
locale = locale.presence || Organization.find(org_id).default_locale
comment.new_body = {
diff --git a/db/migrate/20201119033578_add_commentable_counter_cache_to_comments.decidim_comments.rb b/db/migrate/20201119033578_add_commentable_counter_cache_to_comments.decidim_comments.rb
index 52ea9e78..5314b2e5 100644
--- a/db/migrate/20201119033578_add_commentable_counter_cache_to_comments.decidim_comments.rb
+++ b/db/migrate/20201119033578_add_commentable_counter_cache_to_comments.decidim_comments.rb
@@ -3,7 +3,8 @@
class AddCommentableCounterCacheToComments < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_comments_comments, :comments_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_comments_comments, :comments_count, :integer, null: false, default: 0
+ add_index :decidim_comments_comments, :comments_count
Decidim::Comments::Comment.reset_column_information
Decidim::Comments::Comment.find_each(&:update_comments_count)
end
diff --git a/db/migrate/20201119033580_close_a_meeting.decidim_meetings.rb b/db/migrate/20201119033580_close_a_meeting.decidim_meetings.rb
index 1bf15339..6e1eaff3 100644
--- a/db/migrate/20201119033580_close_a_meeting.decidim_meetings.rb
+++ b/db/migrate/20201119033580_close_a_meeting.decidim_meetings.rb
@@ -7,6 +7,7 @@ def change
add_column :decidim_meetings_meetings, :attendees_count, :integer
add_column :decidim_meetings_meetings, :contributions_count, :integer
add_column :decidim_meetings_meetings, :attending_organizations, :text
- add_column :decidim_meetings_meetings, :closed_at, :time, index: true
+ add_column :decidim_meetings_meetings, :closed_at, :time
+ add_index :decidim_meetings_meetings, :closed_at
end
end
diff --git a/db/migrate/20201119033597_add_code_to_decidim_meetings_registrations.decidim_meetings.rb b/db/migrate/20201119033597_add_code_to_decidim_meetings_registrations.decidim_meetings.rb
index 44e18aad..c9abfa2b 100644
--- a/db/migrate/20201119033597_add_code_to_decidim_meetings_registrations.decidim_meetings.rb
+++ b/db/migrate/20201119033597_add_code_to_decidim_meetings_registrations.decidim_meetings.rb
@@ -3,6 +3,7 @@
class AddCodeToDecidimMeetingsRegistrations < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_meetings_registrations, :code, :string, index: true
+ add_column :decidim_meetings_registrations, :code, :string
+ add_index :decidim_meetings_registrations, :code
end
end
diff --git a/db/migrate/20201119033600_add_upcoming_events_as_content_block.decidim_meetings.rb b/db/migrate/20201119033600_add_upcoming_events_as_content_block.decidim_meetings.rb
index c2509415..292375cc 100644
--- a/db/migrate/20201119033600_add_upcoming_events_as_content_block.decidim_meetings.rb
+++ b/db/migrate/20201119033600_add_upcoming_events_as_content_block.decidim_meetings.rb
@@ -12,7 +12,7 @@ class ContentBlock < ApplicationRecord
def change
Organization.find_each do |organization|
- next if ContentBlock.where(decidim_organization_id: organization.id).where(manifest_name: "upcoming_events").exists?
+ next if ContentBlock.where(decidim_organization_id: organization.id).exists?(manifest_name: "upcoming_events")
last_weight = ContentBlock.where(decidim_organization_id: organization.id).order("weight DESC").limit(1).pluck(:weight).last.to_i
diff --git a/db/migrate/20201119033613_add_user_group_id_to_proposals.decidim_proposals.rb b/db/migrate/20201119033613_add_user_group_id_to_proposals.decidim_proposals.rb
index a77078a0..ba6d40da 100644
--- a/db/migrate/20201119033613_add_user_group_id_to_proposals.decidim_proposals.rb
+++ b/db/migrate/20201119033613_add_user_group_id_to_proposals.decidim_proposals.rb
@@ -3,6 +3,7 @@
class AddUserGroupIdToProposals < ActiveRecord::Migration[5.0]
def change
- add_column :decidim_proposals_proposals, :decidim_user_group_id, :integer, index: true
+ add_column :decidim_proposals_proposals, :decidim_user_group_id, :integer
+ add_index :decidim_proposals_proposals, :decidim_user_group_id
end
end
diff --git a/db/migrate/20201119033614_add_answers_to_proposals.decidim_proposals.rb b/db/migrate/20201119033614_add_answers_to_proposals.decidim_proposals.rb
index f36e5d73..44dea2a1 100644
--- a/db/migrate/20201119033614_add_answers_to_proposals.decidim_proposals.rb
+++ b/db/migrate/20201119033614_add_answers_to_proposals.decidim_proposals.rb
@@ -3,8 +3,9 @@
class AddAnswersToProposals < ActiveRecord::Migration[5.0]
def change
- add_column :decidim_proposals_proposals, :state, :string, index: true
- add_column :decidim_proposals_proposals, :answered_at, :datetime, index: true
+ add_column :decidim_proposals_proposals, :state, :string
+ add_column :decidim_proposals_proposals, :answered_at, :datetime
+ add_index :decidim_proposals_proposals, :answered_at
add_column :decidim_proposals_proposals, :answer, :jsonb
end
end
diff --git a/db/migrate/20201119033621_migrate_proposal_reports_data_to_reports.decidim_proposals.rb b/db/migrate/20201119033621_migrate_proposal_reports_data_to_reports.decidim_proposals.rb
index 66ccdcfc..1d5ce0cb 100644
--- a/db/migrate/20201119033621_migrate_proposal_reports_data_to_reports.decidim_proposals.rb
+++ b/db/migrate/20201119033621_migrate_proposal_reports_data_to_reports.decidim_proposals.rb
@@ -11,7 +11,7 @@ def change
Decidim::Proposals::ProposalReport.find_each do |proposal_report|
moderation = Decidim::Moderation.find_or_create_by!(reportable: proposal_report.proposal,
participatory_process: proposal_report.proposal.feature.participatory_space)
- Decidim::Report.create!(moderation: moderation,
+ Decidim::Report.create!(moderation:,
user: proposal_report.user,
reason: proposal_report.reason,
details: proposal_report.details)
diff --git a/db/migrate/20201119033627_add_published_at_to_proposals.decidim_proposals.rb b/db/migrate/20201119033627_add_published_at_to_proposals.decidim_proposals.rb
index 7c9c6c03..cff51df3 100644
--- a/db/migrate/20201119033627_add_published_at_to_proposals.decidim_proposals.rb
+++ b/db/migrate/20201119033627_add_published_at_to_proposals.decidim_proposals.rb
@@ -3,7 +3,8 @@
class AddPublishedAtToProposals < ActiveRecord::Migration[5.1]
def up
- add_column :decidim_proposals_proposals, :published_at, :datetime, index: true
+ add_column :decidim_proposals_proposals, :published_at, :datetime
+ add_index :decidim_proposals_proposals, :published_at
# rubocop:disable Rails/SkipsModelValidations
Decidim::Proposals::Proposal.update_all("published_at = updated_at")
# rubocop:enable Rails/SkipsModelValidations
diff --git a/db/migrate/20201119033634_move_authorships_to_coauthorships.decidim_proposals.rb b/db/migrate/20201119033634_move_authorships_to_coauthorships.decidim_proposals.rb
index db5efdee..aa6b1aa8 100644
--- a/db/migrate/20201119033634_move_authorships_to_coauthorships.decidim_proposals.rb
+++ b/db/migrate/20201119033634_move_authorships_to_coauthorships.decidim_proposals.rb
@@ -5,6 +5,7 @@ class MoveAuthorshipsToCoauthorships < ActiveRecord::Migration[5.1]
class Proposal < ApplicationRecord
self.table_name = :decidim_proposals_proposals
end
+
class Coauthorship < ApplicationRecord
self.table_name = :decidim_coauthorships
end
diff --git a/db/migrate/20201119033658_add_commentable_counter_cache_to_proposals.decidim_proposals.rb b/db/migrate/20201119033658_add_commentable_counter_cache_to_proposals.decidim_proposals.rb
index ad83c959..2531819d 100644
--- a/db/migrate/20201119033658_add_commentable_counter_cache_to_proposals.decidim_proposals.rb
+++ b/db/migrate/20201119033658_add_commentable_counter_cache_to_proposals.decidim_proposals.rb
@@ -3,8 +3,10 @@
class AddCommentableCounterCacheToProposals < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_proposals_proposals, :comments_count, :integer, null: false, default: 0, index: true
- add_column :decidim_proposals_collaborative_drafts, :comments_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_proposals_proposals, :comments_count, :integer, null: false, default: 0
+ add_index :decidim_proposals_proposals, :comments_count
+ add_column :decidim_proposals_collaborative_drafts, :comments_count, :integer, null: false, default: 0
+ add_index :decidim_proposals_collaborative_drafts, :comments_count
Decidim::Proposals::Proposal.reset_column_information
Decidim::Proposals::Proposal.find_each(&:update_comments_count)
Decidim::Proposals::CollaborativeDraft.reset_column_information
diff --git a/db/migrate/20201119033674_move_budgets_to_own_model.decidim_budgets.rb b/db/migrate/20201119033674_move_budgets_to_own_model.decidim_budgets.rb
index 179be9b6..7eff9654 100644
--- a/db/migrate/20201119033674_move_budgets_to_own_model.decidim_budgets.rb
+++ b/db/migrate/20201119033674_move_budgets_to_own_model.decidim_budgets.rb
@@ -34,8 +34,10 @@ def up
end
def down
- add_column :decidim_budgets_projects, :decidim_component_id, :integer, index: true
- add_column :decidim_budgets_orders, :decidim_component_id, :integer, index: true
+ add_column :decidim_budgets_projects, :decidim_component_id, :integer
+ add_index :decidim_budgets_projects, :decidim_component_id
+ add_column :decidim_budgets_orders, :decidim_component_id, :integer
+ add_index :decidim_budgets_orders, :decidim_component_id
Budget.find_each do |resource|
revert_budget_to_component(resource)
diff --git a/db/migrate/20201119033676_add_selected_at_to_project.decidim_budgets.rb b/db/migrate/20201119033676_add_selected_at_to_project.decidim_budgets.rb
index 758441c7..9bcc239f 100644
--- a/db/migrate/20201119033676_add_selected_at_to_project.decidim_budgets.rb
+++ b/db/migrate/20201119033676_add_selected_at_to_project.decidim_budgets.rb
@@ -3,6 +3,7 @@
class AddSelectedAtToProject < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_budgets_projects, :selected_at, :date, index: true
+ add_column :decidim_budgets_projects, :selected_at, :date
+ add_index :decidim_budgets_projects, :selected_at
end
end
diff --git a/db/migrate/20201119033677_votes_enabled_to_votes_choices.decidim_budgets.rb b/db/migrate/20201119033677_votes_enabled_to_votes_choices.decidim_budgets.rb
index 3c62b11f..4b2d7179 100644
--- a/db/migrate/20201119033677_votes_enabled_to_votes_choices.decidim_budgets.rb
+++ b/db/migrate/20201119033677_votes_enabled_to_votes_choices.decidim_budgets.rb
@@ -8,22 +8,22 @@ class Component < ApplicationRecord
def up
budget_components.each do |component|
- steps = component["settings"] && component["settings"].dig("steps")
- default_step = component["settings"] && component["settings"].dig("default_step")
+ steps = component["settings"] && component["settings"]["steps"]
+ default_step = component["settings"] && component["settings"]["default_step"]
if steps.present?
new_steps_settings = component["settings"]["steps"].each_with_object({}) do |(step, config), new_config|
- votes_value = config.dig("votes_enabled") ? "enabled" : "disabled"
+ votes_value = config["votes_enabled"] ? "enabled" : "disabled"
- new_config[step] = config.merge("votes": votes_value).except("votes_enabled")
+ new_config[step] = config.merge(votes: votes_value).except("votes_enabled")
new_config
end
component["settings"]["steps"] = new_steps_settings
component.save!
elsif default_step.present?
- votes_value = component["settings"]["default_step"].dig("votes_enabled") ? "enabled" : "disabled"
+ votes_value = component["settings"]["default_step"]["votes_enabled"] ? "enabled" : "disabled"
- new_default_step_settings = component["settings"]["default_step"].merge("votes": votes_value).except("votes_enabled")
+ new_default_step_settings = component["settings"]["default_step"].merge(votes: votes_value).except("votes_enabled")
component["settings"]["default_step"] = new_default_step_settings
component.save!
end
diff --git a/db/migrate/20201119033678_add_commentable_counter_cache_to_projects.decidim_budgets.rb b/db/migrate/20201119033678_add_commentable_counter_cache_to_projects.decidim_budgets.rb
index e707926d..ad4ce649 100644
--- a/db/migrate/20201119033678_add_commentable_counter_cache_to_projects.decidim_budgets.rb
+++ b/db/migrate/20201119033678_add_commentable_counter_cache_to_projects.decidim_budgets.rb
@@ -3,7 +3,8 @@
class AddCommentableCounterCacheToProjects < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_budgets_projects, :comments_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_budgets_projects, :comments_count, :integer, null: false, default: 0
+ add_index :decidim_budgets_projects, :comments_count
Decidim::Budgets::Project.reset_column_information
Decidim::Budgets::Project.find_each(&:update_comments_count)
end
diff --git a/db/migrate/20201119033682_add_position_to_surveys_questions.decidim_surveys.rb b/db/migrate/20201119033682_add_position_to_surveys_questions.decidim_surveys.rb
index dff34304..89f6d1ea 100644
--- a/db/migrate/20201119033682_add_position_to_surveys_questions.decidim_surveys.rb
+++ b/db/migrate/20201119033682_add_position_to_surveys_questions.decidim_surveys.rb
@@ -3,6 +3,7 @@
class AddPositionToSurveysQuestions < ActiveRecord::Migration[5.0]
def change
- add_column :decidim_surveys_survey_questions, :position, :integer, index: true
+ add_column :decidim_surveys_survey_questions, :position, :integer
+ add_index :decidim_surveys_survey_questions, :position
end
end
diff --git a/db/migrate/20201119033695_check_legacy_tables.decidim_surveys.rb b/db/migrate/20201119033695_check_legacy_tables.decidim_surveys.rb
index 020ab5ef..ba20fd20 100644
--- a/db/migrate/20201119033695_check_legacy_tables.decidim_surveys.rb
+++ b/db/migrate/20201119033695_check_legacy_tables.decidim_surveys.rb
@@ -62,7 +62,7 @@ def migrate_legacy_data
puts "Migrating question #{survey_question.id}..."
question = ::Decidim::Forms::Question.create!(
- questionnaire: questionnaire,
+ questionnaire:,
position: survey_question.position,
question_type: survey_question.question_type,
mandatory: survey_question.mandatory,
@@ -78,7 +78,7 @@ def migrate_legacy_data
AnswerOption.where(decidim_survey_question_id: survey_question.id).find_each do |survey_answer_option|
answer_option_mapping[survey_answer_option.id] = ::Decidim::Forms::AnswerOption.create!(
- question: question,
+ question:,
body: survey_answer_option.body,
free_text: survey_answer_option.free_text
)
@@ -86,8 +86,8 @@ def migrate_legacy_data
Answer.where(decidim_survey_id: survey.id, decidim_survey_question_id: survey_question.id).find_each do |survey_answer|
answer = ::Decidim::Forms::Answer.new(
- questionnaire: questionnaire,
- question: question,
+ questionnaire:,
+ question:,
decidim_user_id: survey_answer.decidim_user_id,
body: survey_answer.body,
created_at: survey_answer.created_at,
diff --git a/db/migrate/20201119033710_add_external_id_to_results.decidim_accountability.rb b/db/migrate/20201119033710_add_external_id_to_results.decidim_accountability.rb
index f085ea56..78a09c60 100644
--- a/db/migrate/20201119033710_add_external_id_to_results.decidim_accountability.rb
+++ b/db/migrate/20201119033710_add_external_id_to_results.decidim_accountability.rb
@@ -3,6 +3,6 @@
class AddExternalIdToResults < ActiveRecord::Migration[5.1]
def change
- add_column :decidim_accountability_results, :external_id, :string, index: true
+ add_column :decidim_accountability_results, :external_id, :string
end
end
diff --git a/db/migrate/20201119033712_add_commentable_counter_cache_to_results.decidim_accountability.rb b/db/migrate/20201119033712_add_commentable_counter_cache_to_results.decidim_accountability.rb
index fde66933..3f70ad28 100644
--- a/db/migrate/20201119033712_add_commentable_counter_cache_to_results.decidim_accountability.rb
+++ b/db/migrate/20201119033712_add_commentable_counter_cache_to_results.decidim_accountability.rb
@@ -3,7 +3,8 @@
class AddCommentableCounterCacheToResults < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_accountability_results, :comments_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_accountability_results, :comments_count, :integer, null: false, default: 0
+ add_index :decidim_accountability_results, :comments_count
Decidim::Accountability::Result.reset_column_information
Decidim::Accountability::Result.find_each(&:update_comments_count)
end
diff --git a/db/migrate/20201119033721_add_organization_as_author_to_debates.decidim_debates.rb b/db/migrate/20201119033721_add_organization_as_author_to_debates.decidim_debates.rb
index 50257d5b..fd478e72 100644
--- a/db/migrate/20201119033721_add_organization_as_author_to_debates.decidim_debates.rb
+++ b/db/migrate/20201119033721_add_organization_as_author_to_debates.decidim_debates.rb
@@ -6,9 +6,11 @@ class Debate < ApplicationRecord
self.table_name = :decidim_debates_debates
include Decidim::HasComponent
end
+
class User < ApplicationRecord
self.table_name = :decidim_users
end
+
def change
add_column :decidim_debates_debates, :decidim_author_type, :string
diff --git a/db/migrate/20201119033724_fix_debates_i18n_fields.decidim_debates.rb b/db/migrate/20201119033724_fix_debates_i18n_fields.decidim_debates.rb
index 9e11a8d8..314d1a06 100644
--- a/db/migrate/20201119033724_fix_debates_i18n_fields.decidim_debates.rb
+++ b/db/migrate/20201119033724_fix_debates_i18n_fields.decidim_debates.rb
@@ -18,7 +18,7 @@ def change
reset_column_information
debates.find_each do |debate|
- locale, org_id = User.where(id: debate.decidim_author_id).pluck(:locale, :decidim_organization_id).first
+ locale, org_id = User.where(id: debate.decidim_author_id).pick(:locale, :decidim_organization_id)
locale = locale.presence || Organization.find(org_id).default_locale
locale = locale.to_s
diff --git a/db/migrate/20201119033726_add_commentable_counter_cache_to_debates.decidim_debates.rb b/db/migrate/20201119033726_add_commentable_counter_cache_to_debates.decidim_debates.rb
index 2dba74d7..2cd22614 100644
--- a/db/migrate/20201119033726_add_commentable_counter_cache_to_debates.decidim_debates.rb
+++ b/db/migrate/20201119033726_add_commentable_counter_cache_to_debates.decidim_debates.rb
@@ -3,7 +3,8 @@
class AddCommentableCounterCacheToDebates < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_debates_debates, :comments_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_debates_debates, :comments_count, :integer, null: false, default: 0
+ add_index :decidim_debates_debates, :comments_count
Decidim::Debates::Debate.reset_column_information
# rubocop:disable Rails/SkipsModelValidations
diff --git a/db/migrate/20201119033735_add_cancel_data_to_sortition.decidim_sortitions.rb b/db/migrate/20201119033735_add_cancel_data_to_sortition.decidim_sortitions.rb
index 2c84de02..6f33e47c 100644
--- a/db/migrate/20201119033735_add_cancel_data_to_sortition.decidim_sortitions.rb
+++ b/db/migrate/20201119033735_add_cancel_data_to_sortition.decidim_sortitions.rb
@@ -5,6 +5,6 @@ class AddCancelDataToSortition < ActiveRecord::Migration[5.1]
def change
add_column :decidim_module_sortitions_sortitions, :cancel_reason, :jsonb
add_column :decidim_module_sortitions_sortitions, :cancelled_on, :datetime
- add_column :decidim_module_sortitions_sortitions, :cancelled_by_user_id, :integer, index: true
+ add_column :decidim_module_sortitions_sortitions, :cancelled_by_user_id, :integer
end
end
diff --git a/db/migrate/20201119033743_add_commentable_counter_cache_to_sortitions.decidim_sortitions.rb b/db/migrate/20201119033743_add_commentable_counter_cache_to_sortitions.decidim_sortitions.rb
index 5a5b44fb..8f27a251 100644
--- a/db/migrate/20201119033743_add_commentable_counter_cache_to_sortitions.decidim_sortitions.rb
+++ b/db/migrate/20201119033743_add_commentable_counter_cache_to_sortitions.decidim_sortitions.rb
@@ -3,7 +3,8 @@
class AddCommentableCounterCacheToSortitions < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_sortitions_sortitions, :comments_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_sortitions_sortitions, :comments_count, :integer, null: false, default: 0
+ add_index :decidim_sortitions_sortitions, :comments_count
Decidim::Sortitions::Sortition.reset_column_information
Decidim::Sortitions::Sortition.find_each(&:update_comments_count)
end
diff --git a/db/migrate/20201119033745_add_author_to_decidim_blogs_posts.decidim_blogs.rb b/db/migrate/20201119033745_add_author_to_decidim_blogs_posts.decidim_blogs.rb
index 3c6b44d8..a5bb7944 100644
--- a/db/migrate/20201119033745_add_author_to_decidim_blogs_posts.decidim_blogs.rb
+++ b/db/migrate/20201119033745_add_author_to_decidim_blogs_posts.decidim_blogs.rb
@@ -3,6 +3,7 @@
class AddAuthorToDecidimBlogsPosts < ActiveRecord::Migration[5.1]
def change
- add_column :decidim_blogs_posts, :decidim_author_id, :integer, index: true
+ add_column :decidim_blogs_posts, :decidim_author_id, :integer
+ add_index :decidim_blogs_posts, :decidim_author_id
end
end
diff --git a/db/migrate/20201119033750_add_commentable_counter_cache_to_posts.decidim_blogs.rb b/db/migrate/20201119033750_add_commentable_counter_cache_to_posts.decidim_blogs.rb
index 5100ffc2..6ffb3746 100644
--- a/db/migrate/20201119033750_add_commentable_counter_cache_to_posts.decidim_blogs.rb
+++ b/db/migrate/20201119033750_add_commentable_counter_cache_to_posts.decidim_blogs.rb
@@ -3,7 +3,8 @@
class AddCommentableCounterCacheToPosts < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_blogs_posts, :comments_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_blogs_posts, :comments_count, :integer, null: false, default: 0
+ add_index :decidim_blogs_posts, :comments_count
Decidim::Blogs::Post.reset_column_information
Decidim::Blogs::Post.find_each(&:update_comments_count)
end
diff --git a/db/migrate/20210504091507_create_delayed_jobs.rb b/db/migrate/20210504091507_create_delayed_jobs.rb
index d10f2400..372ec2e7 100644
--- a/db/migrate/20210504091507_create_delayed_jobs.rb
+++ b/db/migrate/20210504091507_create_delayed_jobs.rb
@@ -1,15 +1,16 @@
+# frozen_string_literal: true
class CreateDelayedJobs < ActiveRecord::Migration[5.2]
def self.up
create_table :delayed_jobs, force: true do |table|
table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue
table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually.
- table.text :handler, null: false # YAML-encoded string of the object that will do work
- table.text :last_error # reason for last failure (See Note below)
- table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
- table.datetime :locked_at # Set when a client is working on this object
- table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
- table.string :locked_by # Who is working on this object (if locked)
- table.string :queue # The name of the queue this job is in
+ table.text :handler, null: false # YAML-encoded string of the object that will do work
+ table.text :last_error # reason for last failure (See Note below)
+ table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
+ table.datetime :locked_at # Set when a client is working on this object
+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
+ table.string :locked_by # Who is working on this object (if locked)
+ table.string :queue # The name of the queue this job is in
table.timestamps null: true
end
diff --git a/db/migrate/20210506091764_add_followable_counter_cache_to_users.decidim.rb b/db/migrate/20210506091764_add_followable_counter_cache_to_users.decidim.rb
index 1f0e0029..9425bf3a 100644
--- a/db/migrate/20210506091764_add_followable_counter_cache_to_users.decidim.rb
+++ b/db/migrate/20210506091764_add_followable_counter_cache_to_users.decidim.rb
@@ -3,7 +3,8 @@
class AddFollowableCounterCacheToUsers < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_users, :follows_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_users, :follows_count, :integer, null: false, default: 0
+ add_index :decidim_users, :follows_count
reversible do |dir|
dir.up do
diff --git a/db/migrate/20210506091770_add_promoted_flag_to_decidim_participatory_process_groups.decidim_participatory_processes.rb b/db/migrate/20210506091770_add_promoted_flag_to_decidim_participatory_process_groups.decidim_participatory_processes.rb
index e63002a0..90a43c39 100644
--- a/db/migrate/20210506091770_add_promoted_flag_to_decidim_participatory_process_groups.decidim_participatory_processes.rb
+++ b/db/migrate/20210506091770_add_promoted_flag_to_decidim_participatory_process_groups.decidim_participatory_processes.rb
@@ -3,6 +3,7 @@
class AddPromotedFlagToDecidimParticipatoryProcessGroups < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_participatory_process_groups, :promoted, :boolean, default: false, index: true
+ add_column :decidim_participatory_process_groups, :promoted, :boolean, default: false
+ add_index :decidim_participatory_process_groups, :promoted
end
end
diff --git a/db/migrate/20210506091772_add_followable_counter_cache_to_participatory_processes.decidim_participatory_processes.rb b/db/migrate/20210506091772_add_followable_counter_cache_to_participatory_processes.decidim_participatory_processes.rb
index 188adcdf..6580e1c2 100644
--- a/db/migrate/20210506091772_add_followable_counter_cache_to_participatory_processes.decidim_participatory_processes.rb
+++ b/db/migrate/20210506091772_add_followable_counter_cache_to_participatory_processes.decidim_participatory_processes.rb
@@ -3,7 +3,8 @@
class AddFollowableCounterCacheToParticipatoryProcesses < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_participatory_processes, :follows_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_participatory_processes, :follows_count, :integer, null: false, default: 0
+ add_index :decidim_participatory_processes, :follows_count
reversible do |dir|
dir.up do
diff --git a/db/migrate/20210506091774_add_followable_counter_cache_to_assemblies.decidim_assemblies.rb b/db/migrate/20210506091774_add_followable_counter_cache_to_assemblies.decidim_assemblies.rb
index f56e5f34..dd3cb3ac 100644
--- a/db/migrate/20210506091774_add_followable_counter_cache_to_assemblies.decidim_assemblies.rb
+++ b/db/migrate/20210506091774_add_followable_counter_cache_to_assemblies.decidim_assemblies.rb
@@ -3,7 +3,8 @@
class AddFollowableCounterCacheToAssemblies < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_assemblies, :follows_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_assemblies, :follows_count, :integer, null: false, default: 0
+ add_index :decidim_assemblies, :follows_count
reversible do |dir|
dir.up do
diff --git a/db/migrate/20210506091778_add_followable_counter_cache_to_meetings.decidim_meetings.rb b/db/migrate/20210506091778_add_followable_counter_cache_to_meetings.decidim_meetings.rb
index fa6d9243..1af352eb 100644
--- a/db/migrate/20210506091778_add_followable_counter_cache_to_meetings.decidim_meetings.rb
+++ b/db/migrate/20210506091778_add_followable_counter_cache_to_meetings.decidim_meetings.rb
@@ -3,7 +3,8 @@
class AddFollowableCounterCacheToMeetings < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_meetings_meetings, :follows_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_meetings_meetings, :follows_count, :integer, null: false, default: 0
+ add_index :decidim_meetings_meetings, :follows_count
reversible do |dir|
dir.up do
diff --git a/db/migrate/20210506091780_add_followable_counter_cache_to_proposals.decidim_proposals.rb b/db/migrate/20210506091780_add_followable_counter_cache_to_proposals.decidim_proposals.rb
index 0eb81ad0..d305ae54 100644
--- a/db/migrate/20210506091780_add_followable_counter_cache_to_proposals.decidim_proposals.rb
+++ b/db/migrate/20210506091780_add_followable_counter_cache_to_proposals.decidim_proposals.rb
@@ -3,7 +3,8 @@
class AddFollowableCounterCacheToProposals < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_proposals_proposals, :follows_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_proposals_proposals, :follows_count, :integer, null: false, default: 0
+ add_index :decidim_proposals_proposals, :follows_count
reversible do |dir|
dir.up do
diff --git a/db/migrate/20210506091781_add_followable_counter_cache_to_collaborative_drafts.decidim_proposals.rb b/db/migrate/20210506091781_add_followable_counter_cache_to_collaborative_drafts.decidim_proposals.rb
index 1d9209c4..3f133d5a 100644
--- a/db/migrate/20210506091781_add_followable_counter_cache_to_collaborative_drafts.decidim_proposals.rb
+++ b/db/migrate/20210506091781_add_followable_counter_cache_to_collaborative_drafts.decidim_proposals.rb
@@ -3,7 +3,8 @@
class AddFollowableCounterCacheToCollaborativeDrafts < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_proposals_collaborative_drafts, :follows_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_proposals_collaborative_drafts, :follows_count, :integer, null: false, default: 0
+ add_index :decidim_proposals_collaborative_drafts, :follows_count
reversible do |dir|
dir.up do
diff --git a/db/migrate/20210506091783_add_followable_counter_cache_to_budgets.decidim_budgets.rb b/db/migrate/20210506091783_add_followable_counter_cache_to_budgets.decidim_budgets.rb
index 8b8d0454..1dccf772 100644
--- a/db/migrate/20210506091783_add_followable_counter_cache_to_budgets.decidim_budgets.rb
+++ b/db/migrate/20210506091783_add_followable_counter_cache_to_budgets.decidim_budgets.rb
@@ -3,7 +3,8 @@
class AddFollowableCounterCacheToBudgets < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_budgets_projects, :follows_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_budgets_projects, :follows_count, :integer, null: false, default: 0
+ add_index :decidim_budgets_projects, :follows_count
reversible do |dir|
dir.up do
diff --git a/db/migrate/20210506091787_add_followable_counter_cache_to_debates.decidim_debates.rb b/db/migrate/20210506091787_add_followable_counter_cache_to_debates.decidim_debates.rb
index a91eb4d2..ae263327 100644
--- a/db/migrate/20210506091787_add_followable_counter_cache_to_debates.decidim_debates.rb
+++ b/db/migrate/20210506091787_add_followable_counter_cache_to_debates.decidim_debates.rb
@@ -3,7 +3,8 @@
class AddFollowableCounterCacheToDebates < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_debates_debates, :follows_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_debates_debates, :follows_count, :integer, null: false, default: 0
+ add_index :decidim_debates_debates, :follows_count
reversible do |dir|
dir.up do
diff --git a/db/migrate/20210506091788_add_followable_counter_cache_to_blogs.decidim_blogs.rb b/db/migrate/20210506091788_add_followable_counter_cache_to_blogs.decidim_blogs.rb
index 6542c755..db382a91 100644
--- a/db/migrate/20210506091788_add_followable_counter_cache_to_blogs.decidim_blogs.rb
+++ b/db/migrate/20210506091788_add_followable_counter_cache_to_blogs.decidim_blogs.rb
@@ -3,7 +3,8 @@
class AddFollowableCounterCacheToBlogs < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_blogs_posts, :follows_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_blogs_posts, :follows_count, :integer, null: false, default: 0
+ add_index :decidim_blogs_posts, :follows_count
reversible do |dir|
dir.up do
diff --git a/db/migrate/20210528030410_add_reference_registration_type_to_conference_registration.decidim_conferences.rb b/db/migrate/20210528030410_add_reference_registration_type_to_conference_registration.decidim_conferences.rb
index f2c3dff5..14a3c8a5 100644
--- a/db/migrate/20210528030410_add_reference_registration_type_to_conference_registration.decidim_conferences.rb
+++ b/db/migrate/20210528030410_add_reference_registration_type_to_conference_registration.decidim_conferences.rb
@@ -4,7 +4,9 @@
class AddReferenceRegistrationTypeToConferenceRegistration < ActiveRecord::Migration[5.2]
def change
add_column :decidim_conferences_conference_registrations, :decidim_conference_registration_type_id,
- :integer, index: { name: "idx_conference_registration_to_registration_type_id" }
- add_column :decidim_conferences_conference_registrations, :confirmed_at, :datetime, index: true
+ :integer
+ add_index :decidim_conferences_conference_registrations, :decidim_conference_registration_type_id, name: "idx_conference_registration_to_registration_type_id"
+ add_column :decidim_conferences_conference_registrations, :confirmed_at, :datetime
+ add_index :decidim_conferences_conference_registrations, :confirmed_at, name: "idx_conference_registration_to_confirmed_at"
end
end
diff --git a/db/migrate/20210528030411_add_registration_type_to_conference_invite.decidim_conferences.rb b/db/migrate/20210528030411_add_registration_type_to_conference_invite.decidim_conferences.rb
index 1f6289f3..8dbb0d80 100644
--- a/db/migrate/20210528030411_add_registration_type_to_conference_invite.decidim_conferences.rb
+++ b/db/migrate/20210528030411_add_registration_type_to_conference_invite.decidim_conferences.rb
@@ -4,6 +4,7 @@
class AddRegistrationTypeToConferenceInvite < ActiveRecord::Migration[5.2]
def change
add_column :decidim_conferences_conference_invites, :decidim_conference_registration_type_id,
- :integer, index: { name: "idx_conference_invite_to_registration_type_id" }
+ :integer
+ add_index :decidim_conferences_conference_invites, :decidim_conference_registration_type_id, name: "idx_conference_invite_to_registration_type_id"
end
end
diff --git a/db/migrate/20210528030412_add_diploma_fields_to_conference.decidim_conferences.rb b/db/migrate/20210528030412_add_diploma_fields_to_conference.decidim_conferences.rb
index c4d14d27..c296dd73 100644
--- a/db/migrate/20210528030412_add_diploma_fields_to_conference.decidim_conferences.rb
+++ b/db/migrate/20210528030412_add_diploma_fields_to_conference.decidim_conferences.rb
@@ -6,7 +6,9 @@ def change
add_column :decidim_conferences, :signature_name, :string
add_column :decidim_conferences, :signature, :string
add_column :decidim_conferences, :main_logo, :string
- add_column :decidim_conferences, :sign_date, :date, index: true
- add_column :decidim_conferences, :diploma_sent_at, :datetime, index: true
+ add_column :decidim_conferences, :sign_date, :date
+ add_index :decidim_conferences, :sign_date
+ add_column :decidim_conferences, :diploma_sent_at, :datetime
+ add_index :decidim_conferences, :diploma_sent_at
end
end
diff --git a/db/migrate/20210528030417_add_followable_counter_cache_to_conferences.decidim_conferences.rb b/db/migrate/20210528030417_add_followable_counter_cache_to_conferences.decidim_conferences.rb
index af5594a9..7a69f3ee 100644
--- a/db/migrate/20210528030417_add_followable_counter_cache_to_conferences.decidim_conferences.rb
+++ b/db/migrate/20210528030417_add_followable_counter_cache_to_conferences.decidim_conferences.rb
@@ -3,7 +3,8 @@
class AddFollowableCounterCacheToConferences < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_conferences, :follows_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_conferences, :follows_count, :integer, null: false, default: 0
+ add_index :decidim_conferences, :follows_count
reversible do |dir|
dir.up do
diff --git a/db/migrate/20220728111734_add_published_at_to_meetings.decidim_meetings.rb b/db/migrate/20220728111734_add_published_at_to_meetings.decidim_meetings.rb
index 7d5160c3..97276582 100644
--- a/db/migrate/20220728111734_add_published_at_to_meetings.decidim_meetings.rb
+++ b/db/migrate/20220728111734_add_published_at_to_meetings.decidim_meetings.rb
@@ -3,6 +3,7 @@
class AddPublishedAtToMeetings < ActiveRecord::Migration[5.2]
def change
- add_column :decidim_meetings_meetings, :published_at, :datetime, index: true
+ add_column :decidim_meetings_meetings, :published_at, :datetime
+ add_index :decidim_meetings_meetings, :published_at
end
end
diff --git a/db/migrate/20220728111739_drop_decidim_meetings_minutes_table.decidim_meetings.rb b/db/migrate/20220728111739_drop_decidim_meetings_minutes_table.decidim_meetings.rb
index ba5e5bc3..4948993f 100644
--- a/db/migrate/20220728111739_drop_decidim_meetings_minutes_table.decidim_meetings.rb
+++ b/db/migrate/20220728111739_drop_decidim_meetings_minutes_table.decidim_meetings.rb
@@ -73,7 +73,7 @@ def down
private
def blank_minutes?(meeting)
- meeting.video_url.blank? &&
+ (meeting.video_url.blank? &&
meeting.audio_url.blank? &&
- meeting.minutes_description.blank? || meeting.minutes_description.is_a?(Hash) && meeting.minutes_description.values.all?(&:blank?)
+ meeting.minutes_description.blank?) || (meeting.minutes_description.is_a?(Hash) && meeting.minutes_description.values.all?(&:blank?))
end
diff --git a/db/migrate/20220728111740_merge_minutes_with_closing_report_in_meetings_table.decidim_meetings.rb b/db/migrate/20220728111740_merge_minutes_with_closing_report_in_meetings_table.decidim_meetings.rb
index bb5be144..11b2a45f 100644
--- a/db/migrate/20220728111740_merge_minutes_with_closing_report_in_meetings_table.decidim_meetings.rb
+++ b/db/migrate/20220728111740_merge_minutes_with_closing_report_in_meetings_table.decidim_meetings.rb
@@ -54,5 +54,5 @@ def merge_closing_report(meeting)
def minutes_data?(meeting)
[meeting.video_url, meeting.audio_url].any?(&:present?) ||
- meeting.minutes_description.is_a?(Hash) && meeting.minutes_description.values.any?(&:present?)
+ (meeting.minutes_description.is_a?(Hash) && meeting.minutes_description.values.any?(&:present?))
end
diff --git a/db/migrate/20220728111747_add_status_to_meetings_questions.decidim_meetings.rb b/db/migrate/20220728111747_add_status_to_meetings_questions.decidim_meetings.rb
index f14c3b4a..e802b3a2 100644
--- a/db/migrate/20220728111747_add_status_to_meetings_questions.decidim_meetings.rb
+++ b/db/migrate/20220728111747_add_status_to_meetings_questions.decidim_meetings.rb
@@ -3,6 +3,7 @@
class AddStatusToMeetingsQuestions < ActiveRecord::Migration[6.0]
def change
- add_column :decidim_meetings_questions, :status, :integer, default: 0, index: true
+ add_column :decidim_meetings_questions, :status, :integer, default: 0
+ add_index :decidim_meetings_questions, :status
end
end
diff --git a/db/migrate/20220728111749_add_state_field_to_meeting.decidim_meetings.rb b/db/migrate/20220728111749_add_state_field_to_meeting.decidim_meetings.rb
index 54ab50af..4927c9fd 100644
--- a/db/migrate/20220728111749_add_state_field_to_meeting.decidim_meetings.rb
+++ b/db/migrate/20220728111749_add_state_field_to_meeting.decidim_meetings.rb
@@ -3,6 +3,7 @@
class AddStateFieldToMeeting < ActiveRecord::Migration[6.0]
def change
- add_column :decidim_meetings_meetings, :state, :string, index: true
+ add_column :decidim_meetings_meetings, :state, :string
+ add_index :decidim_meetings_meetings, :state
end
end
diff --git a/db/migrate/20220914143129_create_decidim_civicrm_contacts.decidim_civicrm.rb b/db/migrate/20220914143129_create_decidim_civicrm_contacts.decidim_civicrm.rb
index a4b3ac9e..9f109a49 100644
--- a/db/migrate/20220914143129_create_decidim_civicrm_contacts.decidim_civicrm.rb
+++ b/db/migrate/20220914143129_create_decidim_civicrm_contacts.decidim_civicrm.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# This migration comes from decidim_civicrm (originally 20210908095920)
class CreateDecidimCivicrmContacts < ActiveRecord::Migration[5.2]
def change
@@ -13,7 +14,7 @@ def change
t.timestamps
- t.index ["decidim_organization_id", "civicrm_contact_id"], name: "index_unique_civicrm_contact_and_organization", unique: true
+ t.index %w(decidim_organization_id civicrm_contact_id), name: "index_unique_civicrm_contact_and_organization", unique: true
end
end
end
diff --git a/db/migrate/20220914143130_create_decidim_civicrm_groups.decidim_civicrm.rb b/db/migrate/20220914143130_create_decidim_civicrm_groups.decidim_civicrm.rb
index edfe15bd..938ecf8c 100644
--- a/db/migrate/20220914143130_create_decidim_civicrm_groups.decidim_civicrm.rb
+++ b/db/migrate/20220914143130_create_decidim_civicrm_groups.decidim_civicrm.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# This migration comes from decidim_civicrm (originally 20210908095921)
class CreateDecidimCivicrmGroups < ActiveRecord::Migration[5.2]
def change
@@ -10,12 +11,11 @@ def change
t.string :title
t.string :description
t.jsonb :extra, default: {}
-
t.boolean :marked_for_deletion, default: false
t.boolean :auto_sync_members, default: false
- t.index ["decidim_organization_id", "civicrm_group_id"], name: "index_unique_civicrm_group_and_organization", unique: true
+ t.index %w(decidim_organization_id civicrm_group_id), name: "index_unique_civicrm_group_and_organization", unique: true
t.timestamps
end
end
diff --git a/db/migrate/20220914143131_create_decidim_civicrm_group_memberships.decidim_civicrm.rb b/db/migrate/20220914143131_create_decidim_civicrm_group_memberships.decidim_civicrm.rb
index ea6a182a..99d0769c 100644
--- a/db/migrate/20220914143131_create_decidim_civicrm_group_memberships.decidim_civicrm.rb
+++ b/db/migrate/20220914143131_create_decidim_civicrm_group_memberships.decidim_civicrm.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# This migration comes from decidim_civicrm (originally 20210908095922)
class CreateDecidimCivicrmGroupMemberships < ActiveRecord::Migration[5.2]
def change
@@ -10,8 +11,7 @@ def change
t.timestamps
- t.index ["civicrm_contact_id", "group_id"], name: "index_unique_civicrm_membership_group_and_contact", unique: true
+ t.index %w(civicrm_contact_id group_id), name: "index_unique_civicrm_membership_group_and_contact", unique: true
end
end
end
-
diff --git a/db/migrate/20220914143132_create_decidim_civicrm_membership_types.decidim_civicrm.rb b/db/migrate/20220914143132_create_decidim_civicrm_membership_types.decidim_civicrm.rb
index dce00797..1b4657c5 100644
--- a/db/migrate/20220914143132_create_decidim_civicrm_membership_types.decidim_civicrm.rb
+++ b/db/migrate/20220914143132_create_decidim_civicrm_membership_types.decidim_civicrm.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# This migration comes from decidim_civicrm (originally 20210908095923)
class CreateDecidimCivicrmMembershipTypes < ActiveRecord::Migration[5.2]
def change
diff --git a/db/migrate/20220914143133_create_decidim_civicrm_group_participatory_spaces.decidim_civicrm.rb b/db/migrate/20220914143133_create_decidim_civicrm_group_participatory_spaces.decidim_civicrm.rb
index ede31981..2ae5410b 100644
--- a/db/migrate/20220914143133_create_decidim_civicrm_group_participatory_spaces.decidim_civicrm.rb
+++ b/db/migrate/20220914143133_create_decidim_civicrm_group_participatory_spaces.decidim_civicrm.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# This migration comes from decidim_civicrm (originally 20211009165842)
class CreateDecidimCivicrmGroupParticipatorySpaces < ActiveRecord::Migration[5.2]
def change
@@ -7,7 +8,7 @@ def change
t.timestamps
- t.index ["group_id", "participatory_space_type", "participatory_space_id"], name: "index_unique_civicrm_space_and_group", unique: true
+ t.index %w(group_id participatory_space_type participatory_space_id), name: "index_unique_civicrm_space_and_group", unique: true
end
end
end
diff --git a/db/migrate/20220914143134_create_decidim_civicrm_event_meetings.decidim_civicrm.rb b/db/migrate/20220914143134_create_decidim_civicrm_event_meetings.decidim_civicrm.rb
index b3399733..efd17536 100644
--- a/db/migrate/20220914143134_create_decidim_civicrm_event_meetings.decidim_civicrm.rb
+++ b/db/migrate/20220914143134_create_decidim_civicrm_event_meetings.decidim_civicrm.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# This migration comes from decidim_civicrm (originally 20211025165842)
class CreateDecidimCivicrmEventMeetings < ActiveRecord::Migration[5.2]
def change
diff --git a/db/migrate/20220914143135_create_decidim_civicrm_event_registrations.decidim_civicrm.rb b/db/migrate/20220914143135_create_decidim_civicrm_event_registrations.decidim_civicrm.rb
index fa5c3a4b..087c2485 100644
--- a/db/migrate/20220914143135_create_decidim_civicrm_event_registrations.decidim_civicrm.rb
+++ b/db/migrate/20220914143135_create_decidim_civicrm_event_registrations.decidim_civicrm.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# This migration comes from decidim_civicrm (originally 20211027165842)
class CreateDecidimCivicrmEventRegistrations < ActiveRecord::Migration[5.2]
def change
diff --git a/db/migrate/20220914143136_add_membership_types_to_contacts.decidim_civicrm.rb b/db/migrate/20220914143136_add_membership_types_to_contacts.decidim_civicrm.rb
index af8126f7..1ae9a16f 100644
--- a/db/migrate/20220914143136_add_membership_types_to_contacts.decidim_civicrm.rb
+++ b/db/migrate/20220914143136_add_membership_types_to_contacts.decidim_civicrm.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# This migration comes from decidim_civicrm (originally 20211126132120)
class AddMembershipTypesToContacts < ActiveRecord::Migration[5.2]
def change
diff --git a/db/migrate/20221103233649_remove_not_null_from_civicrm_event_meetings.decidim_civicrm.rb b/db/migrate/20221103233649_remove_not_null_from_civicrm_event_meetings.decidim_civicrm.rb
index 2f0db685..22915bd8 100644
--- a/db/migrate/20221103233649_remove_not_null_from_civicrm_event_meetings.decidim_civicrm.rb
+++ b/db/migrate/20221103233649_remove_not_null_from_civicrm_event_meetings.decidim_civicrm.rb
@@ -1,7 +1,8 @@
+# frozen_string_literal: true
# This migration comes from decidim_civicrm (originally 20221103213837)
class RemoveNotNullFromCivicrmEventMeetings < ActiveRecord::Migration[6.0]
def change
change_column_null :decidim_civicrm_event_meetings, :decidim_meeting_id, true
- add_index :decidim_civicrm_event_meetings, ["civicrm_event_id", "decidim_organization_id"], name: "index_unique_civicrm_event_organization", unique: true
+ add_index :decidim_civicrm_event_meetings, %w(civicrm_event_id decidim_organization_id), name: "index_unique_civicrm_event_organization", unique: true
end
end
diff --git a/db/migrate/20231129095536_add_notifications_sending_frequency_to_users.decidim.rb b/db/migrate/20231129095536_add_notifications_sending_frequency_to_users.decidim.rb
index 02ecfe6a..a72f3efa 100644
--- a/db/migrate/20231129095536_add_notifications_sending_frequency_to_users.decidim.rb
+++ b/db/migrate/20231129095536_add_notifications_sending_frequency_to_users.decidim.rb
@@ -3,6 +3,6 @@
class AddNotificationsSendingFrequencyToUsers < ActiveRecord::Migration[6.0]
def change
- add_column :decidim_users, :notifications_sending_frequency, :string, default: "daily", index: true
+ add_column :decidim_users, :notifications_sending_frequency, :string, default: "daily"
end
end
diff --git a/db/migrate/20240705123824_add_comment_vote_counter_cache_to_comments.decidim_comments.rb b/db/migrate/20240705123824_add_comment_vote_counter_cache_to_comments.decidim_comments.rb
index e4c0f576..86d8d653 100644
--- a/db/migrate/20240705123824_add_comment_vote_counter_cache_to_comments.decidim_comments.rb
+++ b/db/migrate/20240705123824_add_comment_vote_counter_cache_to_comments.decidim_comments.rb
@@ -3,8 +3,10 @@
class AddCommentVoteCounterCacheToComments < ActiveRecord::Migration[6.1]
def change
- add_column :decidim_comments_comments, :up_votes_count, :integer, null: false, default: 0, index: true
- add_column :decidim_comments_comments, :down_votes_count, :integer, null: false, default: 0, index: true
+ add_column :decidim_comments_comments, :up_votes_count, :integer, null: false, default: 0
+ add_index :decidim_comments_comments, :up_votes_count
+ add_column :decidim_comments_comments, :down_votes_count, :integer, null: false, default: 0
+ add_index :decidim_comments_comments, :down_votes_count
# We cannot use the reset_counters as up_votes and down_votes are scoped associationws
reversible do |dir|
diff --git a/db/schema.rb b/db/schema.rb
index 56c6fc9a..cb68ed59 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -62,6 +62,7 @@
t.float "weight", default: 1.0
t.string "external_id"
t.integer "comments_count", default: 0, null: false
+ t.index ["comments_count"], name: "index_decidim_accountability_results_on_comments_count"
t.index ["decidim_accountability_status_id"], name: "decidim_accountability_results_on_status_id"
t.index ["decidim_component_id"], name: "index_decidim_accountability_results_on_decidim_component_id"
t.index ["decidim_scope_id"], name: "index_decidim_accountability_results_on_decidim_scope_id"
@@ -206,6 +207,7 @@
t.index ["decidim_organization_id", "slug"], name: "index_unique_assembly_slug_and_organization", unique: true
t.index ["decidim_organization_id"], name: "index_decidim_assemblies_on_decidim_organization_id"
t.index ["decidim_scope_id"], name: "index_decidim_assemblies_on_decidim_scope_id"
+ t.index ["follows_count"], name: "index_decidim_assemblies_on_follows_count"
t.index ["parent_id"], name: "decidim_assemblies_assemblies_on_parent_id"
end
@@ -274,6 +276,7 @@
t.integer "weight", default: 0, null: false
t.integer "attachment_collection_id"
t.index ["attached_to_id", "attached_to_type"], name: "index_decidim_attachments_on_attached_to"
+ t.index ["attachment_collection_id"], name: "index_decidim_attachments_attachment_collection_id"
t.index ["attachment_collection_id"], name: "index_decidim_attachments_on_attachment_collection_id"
end
@@ -374,9 +377,12 @@
t.integer "comments_count", default: 0, null: false
t.integer "follows_count", default: 0, null: false
t.datetime "published_at"
+ t.index ["comments_count"], name: "index_decidim_blogs_posts_on_comments_count"
t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_blogs_posts_on_decidim_author"
+ t.index ["decidim_author_id"], name: "index_decidim_blogs_posts_on_decidim_author_id"
t.index ["decidim_component_id"], name: "index_decidim_blogs_posts_on_decidim_component_id"
t.index ["decidim_user_group_id"], name: "index_decidim_blogs_posts_on_decidim_user_group_id"
+ t.index ["follows_count"], name: "index_decidim_blogs_posts_on_follows_count"
end
create_table "decidim_budgets_budgets", id: :serial, force: :cascade do |t|
@@ -425,8 +431,11 @@
t.text "address"
t.float "latitude"
t.float "longitude"
+ t.index ["comments_count"], name: "index_decidim_budgets_projects_on_comments_count"
t.index ["decidim_budgets_budget_id"], name: "index_decidim_budgets_projects_on_decidim_budgets_budget_id"
t.index ["decidim_scope_id"], name: "index_decidim_budgets_projects_on_decidim_scope_id"
+ t.index ["follows_count"], name: "index_decidim_budgets_projects_on_follows_count"
+ t.index ["selected_at"], name: "index_decidim_budgets_projects_on_selected_at"
end
create_table "decidim_calendar_external_events", force: :cascade do |t|
@@ -602,6 +611,7 @@
t.datetime "deleted_at"
t.integer "up_votes_count", default: 0, null: false
t.integer "down_votes_count", default: 0, null: false
+ t.index ["comments_count"], name: "index_decidim_comments_comments_on_comments_count"
t.index ["created_at"], name: "index_decidim_comments_comments_on_created_at"
t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_comments_comments_on_decidim_author"
t.index ["decidim_author_id"], name: "decidim_comments_comment_author"
@@ -609,6 +619,8 @@
t.index ["decidim_participatory_space_id", "decidim_participatory_space_type"], name: "index_decidim_comments_on_decidim_participatory_space"
t.index ["decidim_root_commentable_type", "decidim_root_commentable_id"], name: "decidim_comments_comment_root_commentable"
t.index ["decidim_user_group_id"], name: "index_decidim_comments_comments_on_decidim_user_group_id"
+ t.index ["down_votes_count"], name: "index_decidim_comments_comments_on_down_votes_count"
+ t.index ["up_votes_count"], name: "index_decidim_comments_comments_on_up_votes_count"
end
create_table "decidim_components", id: :serial, force: :cascade do |t|
@@ -692,6 +704,9 @@
t.index ["decidim_organization_id", "slug"], name: "index_unique_conference_slug_and_organization", unique: true
t.index ["decidim_organization_id"], name: "index_decidim_conferences_on_decidim_organization_id"
t.index ["decidim_scope_id"], name: "index_decidim_conferences_on_decidim_scope_id"
+ t.index ["diploma_sent_at"], name: "index_decidim_conferences_on_diploma_sent_at"
+ t.index ["follows_count"], name: "index_decidim_conferences_on_follows_count"
+ t.index ["sign_date"], name: "index_decidim_conferences_on_sign_date"
end
create_table "decidim_conferences_conference_invites", force: :cascade do |t|
@@ -704,6 +719,7 @@
t.datetime "updated_at", null: false
t.integer "decidim_conference_registration_type_id"
t.index ["decidim_conference_id"], name: "idx_decidim_conferences_invites_on_conference_id"
+ t.index ["decidim_conference_registration_type_id"], name: "idx_conference_invite_to_registration_type_id"
t.index ["decidim_conference_registration_type_id"], name: "ixd_conferences_on_registration_type_id"
t.index ["decidim_user_id"], name: "index_decidim_conferences_conference_invites_on_decidim_user_id"
end
@@ -722,7 +738,9 @@
t.datetime "updated_at", null: false
t.integer "decidim_conference_registration_type_id"
t.datetime "confirmed_at"
+ t.index ["confirmed_at"], name: "idx_conference_registration_to_confirmed_at"
t.index ["decidim_conference_id"], name: "index_conferences_registrations_on_decidim_conference"
+ t.index ["decidim_conference_registration_type_id"], name: "idx_conference_registration_to_registration_type_id"
t.index ["decidim_conference_registration_type_id"], name: "idx_conferences_registrations_on_registration_type_id"
t.index ["decidim_user_id", "decidim_conference_id"], name: "decidim_conferences_registrations_user_conference_unique", unique: true
t.index ["decidim_user_id"], name: "index_decidim_conferences_registrations_on_decidim_user_id"
@@ -823,11 +841,13 @@
t.integer "follows_count", default: 0, null: false
t.boolean "comments_enabled", default: true
t.index ["closed_at"], name: "index_decidim_debates_debates_on_closed_at"
+ t.index ["comments_count"], name: "index_decidim_debates_debates_on_comments_count"
t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_debates_debates_on_decidim_author"
t.index ["decidim_component_id"], name: "index_decidim_debates_debates_on_decidim_component_id"
t.index ["decidim_scope_id"], name: "index_decidim_debates_debates_on_decidim_scope_id"
t.index ["decidim_user_group_id"], name: "index_decidim_debates_debates_on_decidim_user_group_id"
t.index ["endorsements_count"], name: "idx_decidim_debates_debates_on_endorsemnts_count"
+ t.index ["follows_count"], name: "index_decidim_debates_debates_on_follows_count"
end
create_table "decidim_editor_images", force: :cascade do |t|
@@ -1099,10 +1119,14 @@
t.integer "iframe_embed_type", default: 0
t.integer "type_of_meeting", default: 0, null: false
t.integer "registration_type", default: 0, null: false
+ t.index ["closed_at"], name: "index_decidim_meetings_meetings_on_closed_at"
t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_meetings_meetings_on_author"
t.index ["decidim_author_id"], name: "index_decidim_meetings_meetings_on_decidim_author_id"
t.index ["decidim_component_id"], name: "index_decidim_meetings_meetings_on_decidim_component_id"
t.index ["decidim_scope_id"], name: "index_decidim_meetings_meetings_on_decidim_scope_id"
+ t.index ["follows_count"], name: "index_decidim_meetings_meetings_on_follows_count"
+ t.index ["published_at"], name: "index_decidim_meetings_meetings_on_published_at"
+ t.index ["state"], name: "index_decidim_meetings_meetings_on_state"
end
create_table "decidim_meetings_polls", force: :cascade do |t|
@@ -1131,6 +1155,7 @@
t.integer "status", default: 0
t.index ["decidim_questionnaire_id"], name: "index_decidim_meetings_questions_on_decidim_questionnaire_id"
t.index ["position"], name: "index_decidim_meetings_questions_on_position"
+ t.index ["status"], name: "index_decidim_meetings_questions_on_status"
end
create_table "decidim_meetings_registrations", force: :cascade do |t|
@@ -1142,6 +1167,7 @@
t.datetime "validated_at"
t.bigint "decidim_user_group_id"
t.boolean "public_participation", default: false
+ t.index ["code"], name: "index_decidim_meetings_registrations_on_code"
t.index ["decidim_meeting_id"], name: "index_decidim_meetings_registrations_on_decidim_meeting_id"
t.index ["decidim_user_group_id"], name: "index_decidim_meetings_registrations_on_decidim_user_group_id"
t.index ["decidim_user_id", "decidim_meeting_id"], name: "decidim_meetings_registrations_user_meeting_unique", unique: true
@@ -1313,6 +1339,7 @@
t.jsonb "content_security_policy", default: {}
t.index ["host"], name: "index_decidim_organizations_on_host", unique: true
t.index ["name"], name: "index_decidim_organizations_on_name", unique: true
+ t.index ["secondary_hosts"], name: "index_decidim_organizations_on_secondary_hosts"
end
create_table "decidim_pages_pages", id: :serial, force: :cascade do |t|
@@ -1340,6 +1367,7 @@
t.jsonb "participatory_structure"
t.boolean "promoted", default: false
t.index ["decidim_organization_id"], name: "decidim_participatory_process_group_organization"
+ t.index ["promoted"], name: "index_decidim_participatory_process_groups_on_promoted"
end
create_table "decidim_participatory_process_steps", id: :serial, force: :cascade do |t|
@@ -1420,6 +1448,9 @@
t.index ["decidim_participatory_process_type_id"], name: "index_decidim_processes_on_decidim_process_type_id"
t.index ["decidim_scope_id"], name: "idx_process_on_scope_id"
t.index ["decidim_scope_type_id"], name: "index_decidim_participatory_processes_on_decidim_scope_type_id"
+ t.index ["follows_count"], name: "index_decidim_participatory_processes_on_follows_count"
+ t.index ["promoted"], name: "index_decidim_participatory_processes_on_promoted"
+ t.index ["published_at"], name: "index_decidim_participatory_processes_on_published_at"
end
create_table "decidim_participatory_space_links", id: :serial, force: :cascade do |t|
@@ -1473,8 +1504,10 @@
t.integer "follows_count", default: 0, null: false
t.integer "state", default: 0, null: false
t.index ["body"], name: "decidim_proposals_collaborative_draft_body_search"
+ t.index ["comments_count"], name: "index_decidim_proposals_collaborative_drafts_on_comments_count"
t.index ["decidim_component_id"], name: "decidim_proposals_collaborative_drafts_on_decidim_component_id"
t.index ["decidim_scope_id"], name: "decidim_proposals_collaborative_drafts_on_decidim_scope_id"
+ t.index ["follows_count"], name: "index_decidim_proposals_collaborative_drafts_on_follows_count"
t.index ["title"], name: "decidim_proposals_collaborative_drafts_title_search"
t.index ["updated_at"], name: "decidim_proposals_collaborative_drafts_on_updated_at"
end
@@ -1541,10 +1574,14 @@
t.integer "state", default: 0, null: false
t.index "md5((body)::text)", name: "decidim_proposals_proposal_body_search"
t.index "md5((title)::text)", name: "decidim_proposals_proposal_title_search"
+ t.index ["answered_at"], name: "index_decidim_proposals_proposals_on_answered_at"
+ t.index ["comments_count"], name: "index_decidim_proposals_proposals_on_comments_count"
t.index ["created_at"], name: "index_decidim_proposals_proposals_on_created_at"
t.index ["decidim_component_id"], name: "index_decidim_proposals_proposals_on_decidim_component_id"
t.index ["decidim_scope_id"], name: "index_decidim_proposals_proposals_on_decidim_scope_id"
+ t.index ["follows_count"], name: "index_decidim_proposals_proposals_on_follows_count"
t.index ["proposal_votes_count"], name: "index_decidim_proposals_proposals_on_proposal_votes_count"
+ t.index ["published_at"], name: "index_decidim_proposals_proposals_on_published_at"
end
create_table "decidim_proposals_valuation_assignments", force: :cascade do |t|
@@ -1715,6 +1752,7 @@
t.string "decidim_author_type", null: false
t.integer "comments_count", default: 0, null: false
t.index ["cancelled_by_user_id"], name: "index_decidim_sortitions_sortitions_on_cancelled_by_user_id"
+ t.index ["comments_count"], name: "index_decidim_sortitions_sortitions_on_comments_count"
t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_sortitions_sortitions_on_decidim_author"
t.index ["decidim_author_id"], name: "index_decidim_sortitions_sortitions_on_decidim_author_id"
t.index ["decidim_component_id"], name: "index_sortitions__on_feature"
@@ -1909,6 +1947,7 @@
t.index ["confirmation_token"], name: "index_decidim_users_on_confirmation_token", unique: true
t.index ["decidim_organization_id"], name: "index_decidim_users_on_decidim_organization_id"
t.index ["email", "decidim_organization_id"], name: "index_decidim_users_on_email_and_decidim_organization_id", unique: true, where: "((deleted_at IS NULL) AND (managed = false) AND ((type)::text = 'Decidim::User'::text))"
+ t.index ["follows_count"], name: "index_decidim_users_on_follows_count"
t.index ["id", "type"], name: "index_decidim_users_on_id_and_type"
t.index ["invitation_token"], name: "index_decidim_users_on_invitation_token", unique: true
t.index ["invitations_count"], name: "index_decidim_users_on_invitations_count"
diff --git a/spec/lib/overrides_spec.rb b/spec/lib/overrides_spec.rb
index a0305481..69892b01 100644
--- a/spec/lib/overrides_spec.rb
+++ b/spec/lib/overrides_spec.rb
@@ -6,94 +6,93 @@
# as the expected. If this test fails, it means that the overriden
# file should be updated to match any change/bug fix introduced in the core
checksums = [
- {
- package: "decidim-comments",
- files: {
- "/app/cells/decidim/comments/comments_cell.rb" => "2189e89b4ca78b7e4300b1097d2296e5"
- }
- },
+ # {
+ # package: "decidim-comments",
+ # files: {
+ # "/app/cells/decidim/comments/comments_cell.rb" => "2189e89b4ca78b7e4300b1097d2296e5"
+ # }
+ # },
{
package: "decidim-core",
files: {
# controllers
"/app/controllers/decidim/devise/omniauth_registrations_controller.rb" => "d2470bf88b509572affa7f225f6ee424",
- "/app/controllers/decidim/devise/registrations_controller.rb" => "f519953daa03df46b98d34b3311a17d0",
- "/app/controllers/decidim/devise/invitations_controller.rb" => "32ef1da80ec9dd20b884e5829c3307e6",
+ "/app/controllers/decidim/devise/registrations_controller.rb" => "d5f7e3d61b62c3ce2704ecd48f2a080c",
+ "/app/controllers/decidim/devise/invitations_controller.rb" => "0cbb345ec888627a3a66cce00aba2c25",
# layouts
"/app/views/layouts/decidim/_head_extra.html.erb" => "1b8237357754cf519f4e418135f78440",
- "/app/views/decidim/devise/sessions/new.html.erb" => "9d090fc9e565ded80a9330d4e36e495c",
- "/app/views/decidim/devise/shared/_omniauth_buttons_mini.html.erb" => "d3a413ce7c64959eee3b912406075f84",
+ "/app/views/decidim/devise/sessions/new.html.erb" => "a8fe60cd10c1636822c252d5488a979d",
+ "/app/views/decidim/devise/shared/_omniauth_buttons.html.erb" => "de3f80dda35889bc1947d8e6eff3c19a",
+ "/app/views/decidim/shared/_login_modal.html.erb" => "a29d4fcebe8c689044e3c15f6144f3d1",
# cells
- "/app/cells/decidim/date_range/show.erb" => "7e050b942e447386fc96ef6528039cec",
- "/app/cells/decidim/diff/attribute.erb" => "d648bc8e71e27c404d82132d6e3c3241",
- "/app/cells/decidim/diff/diff_mode_dropdown.erb" => "770563c121c875159a88cd5e142658e3",
+ # "/app/cells/decidim/date_range/show.erb" => "7e050b942e447386fc96ef6528039cec",
+ # "/app/cells/decidim/diff/attribute.erb" => "d648bc8e71e27c404d82132d6e3c3241",
+ # "/app/cells/decidim/diff/diff_mode_dropdown.erb" => "770563c121c875159a88cd5e142658e3",
# other overrides
- "/app/helpers/decidim/card_helper.rb" => "b9e7f943ae7c289b2855d328de7b371b",
- "/app/commands/decidim/amendable/accept.rb" => "25b86fc0e881251dbda0a176b4c8a9af",
- "/app/commands/decidim/amendable/reject.rb" => "efd7062b0942b0ec80e336345ffca62f"
+ # "/app/helpers/decidim/card_helper.rb" => "b9e7f943ae7c289b2855d328de7b371b",
+ "/app/commands/decidim/amendable/accept.rb" => "e42b7ef2f975319d608c1fa47cba49bd",
+ "/app/commands/decidim/amendable/reject.rb" => "733c23005c5016c4fdc3e68fd1fc1123"
}
},
- {
- package: "decidim-meetings",
- files: {
- "/app/controllers/decidim/meetings/admin/invites_controller.rb" => "2cf91718146e0223d7b7794f44d5d8c6",
- "/app/cells/decidim/meetings/meeting_m/single_date.erb" => "d7bb73188f6c1299c926bafa59aedc24",
- "/app/cells/decidim/meetings/online_meeting_link/show.erb" => "9557df6e46040a6395c71c75cd84792c",
- "/app/views/decidim/meetings/meetings/show.html.erb" => "1a1ed9e537d856fede9834cde396293d"
- }
- },
- {
- package: "decidim-debates",
- files: {
- "/app/cells/decidim/debates/debate_m/single_date.erb" => "d7bb73188f6c1299c926bafa59aedc24",
- "/app/cells/decidim/debates/debate_m/multiple_dates.erb" => "d56d9a5d2e37cf1a7c75974f6254db4f"
- }
- },
- {
- package: "decidim-assemblies",
- files: {
- "/app/views/decidim/assemblies/assemblies/show.html.erb" => "eeabef769e29b59de98af16d3549dcab"
- }
- },
- {
- package: "decidim-conferences",
- files: {
- "/app/views/decidim/conferences/conferences/show.html.erb" => "94e3fb8ee4e092678ce0f229c87e1bc0",
- "/app/views/layouts/decidim/_conference_hero.html.erb" => "db2e565169a5ce7f8a3e7d03dd0ebfd9"
- }
- },
- {
- package: "decidim-participatory_processes",
- files: {
- "/app/views/decidim/participatory_processes/participatory_processes/show.html.erb" => "747ee665f0c08484436f320865df62cc"
- }
- },
- {
- package: "decidim-forms",
- files: {
- "/app/commands/decidim/forms/answer_questionnaire.rb" => "c53587b220467c2d6889f657ac2404a0"
- }
- },
- {
- package: "decidim-proposals",
- files: {
- "/app/controllers/decidim/proposals/proposals_controller.rb" => "b263741e3335110fa0e37c488c777190",
- "/app/views/decidim/proposals/proposals/index.html.erb" => "48fbf7a8332f5f4c026b793e7922bdbc",
- "/app/views/decidim/proposals/proposals/show.html.erb" => "23188e6a12cc1ac6ce44c857b3b81a4c",
- "/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb" => "b8a9a1b573b2f888b293d10a7fab6577",
- "/app/views/decidim/proposals/proposals/_proposals.html.erb" => "a4057670154210aff98e5f206d0fdfc2",
- "/app/views/decidim/proposals/proposals/_wizard_aside.html.erb" => "45dc17085fabc549bee6474b8a3e79df",
- "/app/views/decidim/proposals/proposals/_filters.html.erb" => "ab4fe3f5b9237d786595374fbb6b729c"
- }
- }
+ # {
+ # package: "decidim-meetings",
+ # files: {
+ # "/app/controllers/decidim/meetings/admin/invites_controller.rb" => "2cf91718146e0223d7b7794f44d5d8c6",
+ # "/app/cells/decidim/meetings/meeting_m/single_date.erb" => "d7bb73188f6c1299c926bafa59aedc24",
+ # "/app/cells/decidim/meetings/online_meeting_link/show.erb" => "9557df6e46040a6395c71c75cd84792c",
+ # "/app/views/decidim/meetings/meetings/show.html.erb" => "1a1ed9e537d856fede9834cde396293d"
+ # }
+ # },
+ # {
+ # package: "decidim-debates",
+ # files: {
+ # "/app/cells/decidim/debates/debate_m/single_date.erb" => "d7bb73188f6c1299c926bafa59aedc24",
+ # "/app/cells/decidim/debates/debate_m/multiple_dates.erb" => "d56d9a5d2e37cf1a7c75974f6254db4f"
+ # }
+ # },
+ # {
+ # package: "decidim-assemblies",
+ # files: {
+ # "/app/views/decidim/assemblies/assemblies/show.html.erb" => "eeabef769e29b59de98af16d3549dcab"
+ # }
+ # },
+ # {
+ # package: "decidim-conferences",
+ # files: {
+ # "/app/views/decidim/conferences/conferences/show.html.erb" => "94e3fb8ee4e092678ce0f229c87e1bc0",
+ # "/app/views/layouts/decidim/_conference_hero.html.erb" => "db2e565169a5ce7f8a3e7d03dd0ebfd9"
+ # }
+ # },
+ # {
+ # package: "decidim-participatory_processes",
+ # files: {
+ # "/app/views/decidim/participatory_processes/participatory_processes/show.html.erb" => "747ee665f0c08484436f320865df62cc"
+ # }
+ # },
+ # {
+ # package: "decidim-forms",
+ # files: {
+ # "/app/commands/decidim/forms/answer_questionnaire.rb" => "c53587b220467c2d6889f657ac2404a0"
+ # }
+ # },
+ # {
+ # package: "decidim-proposals",
+ # files: {
+ # "/app/controllers/decidim/proposals/proposals_controller.rb" => "b263741e3335110fa0e37c488c777190",
+ # "/app/views/decidim/proposals/proposals/index.html.erb" => "48fbf7a8332f5f4c026b793e7922bdbc",
+ # "/app/views/decidim/proposals/proposals/show.html.erb" => "23188e6a12cc1ac6ce44c857b3b81a4c",
+ # "/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb" => "b8a9a1b573b2f888b293d10a7fab6577",
+ # "/app/views/decidim/proposals/proposals/_proposals.html.erb" => "a4057670154210aff98e5f206d0fdfc2",
+ # "/app/views/decidim/proposals/proposals/_wizard_aside.html.erb" => "45dc17085fabc549bee6474b8a3e79df",
+ # "/app/views/decidim/proposals/proposals/_filters.html.erb" => "ab4fe3f5b9237d786595374fbb6b729c"
+ # }
+ # }
]
describe "Overriden files", type: :view do
checksums.each do |item|
- # rubocop:disable Rails/DynamicFindBy
- spec = ::Gem::Specification.find_by_name(item[:package])
- # rubocop:enable Rails/DynamicFindBy
+ spec = Gem::Specification.find_by_name(item[:package])
item[:files].each do |file, signature|
it "#{spec.gem_dir}#{file} matches checksum" do
expect(md5("#{spec.gem_dir}#{file}")).to eq(signature)
diff --git a/spec/system/admin_custom_iframe_spec.rb b/spec/system/admin_custom_iframe_spec.rb
deleted file mode 100644
index e683bc77..00000000
--- a/spec/system/admin_custom_iframe_spec.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: true
-
-require "rails_helper"
-
-describe "Admin" do
- context "when admin access to dashboard" do
- let(:organization) { create(:organization) }
- let!(:user) { create(:user, :confirmed, organization:) }
- let!(:admin) { create(:user, :admin, :confirmed, organization:) }
- let(:url) { "http://example.org" }
-
- before do
- allow(ENV).to receive(:fetch).and_call_original
- allow(ENV).to receive(:fetch).with("ADMIN_IFRAME_URL", nil).and_return(url)
- switch_to_host(organization.host)
- login_as admin, scope: :user
-
- visit decidim_admin.root_path
- end
-
- it "displays custom iframe in the admin menu" do
- click_on "Plausible Stats")
- within ".layout-content" do
- expect(page).to have_content("Plausible Stats")
- expect(page).to have_css("iframe[src='#{url}']")
- end
- end
-
- context "when no url is set" do
- let(:url) { nil }
-
- it "does not display custom iframe in the admin menu" do
- expect(page).to have_no_content("Plausible Stats")")
- end
- end
- end
-end
diff --git a/spec/system/admin_spec.rb b/spec/system/admin_spec.rb
index 787e34c2..7e13ce0d 100644
--- a/spec/system/admin_spec.rb
+++ b/spec/system/admin_spec.rb
@@ -2,9 +2,9 @@
require "rails_helper"
-describe "Visit the signup page", type: :system, perform_enqueued: true do
- let(:organization) { create :organization }
- let(:user) { create :user, :admin, :confirmed, organization: organization }
+describe "Visit the signup page", perform_enqueued: true do
+ let(:organization) { create(:organization) }
+ let(:user) { create(:user, :admin, :confirmed, organization:) }
before do
switch_to_host(organization.host)
diff --git a/spec/system/awesome_tests_spec.rb b/spec/system/awesome_tests_spec.rb
index d7208e6f..708cba27 100644
--- a/spec/system/awesome_tests_spec.rb
+++ b/spec/system/awesome_tests_spec.rb
@@ -2,11 +2,11 @@
require "rails_helper"
-describe "Custom styles", type: :system do
- let(:organization) { create :organization }
- let!(:participatory_process) { create :participatory_process, organization: organization }
- let!(:config) { create :awesome_config, organization: organization, var: :scoped_styles, value: styles }
- let(:config_helper) { create :awesome_config, organization: organization, var: :scoped_style_bar }
+describe "Custom styles" do
+ let(:organization) { create(:organization) }
+ let!(:participatory_process) { create(:participatory_process, organization:) }
+ let!(:config) { create(:awesome_config, organization:, var: :scoped_styles, value: styles) }
+ let(:config_helper) { create(:awesome_config, organization:, var: :scoped_style_bar) }
let(:styles) do
{
"bar" => "body {background: red;}"
@@ -51,7 +51,7 @@
end
context "when constraints are present" do
- let!(:constraint) { create(:config_constraint, awesome_config: config_helper, settings: settings) }
+ let!(:constraint) { create(:config_constraint, awesome_config: config_helper, settings:) }
let(:settings) do
{}
end
diff --git a/spec/system/conference_spec.rb b/spec/system/conference_spec.rb
index af720f0c..46d1ba53 100644
--- a/spec/system/conference_spec.rb
+++ b/spec/system/conference_spec.rb
@@ -3,9 +3,9 @@
require "rails_helper"
require "selenium/webdriver"
-describe "Visit a conference", type: :system do
- let(:organization) { create :organization }
- let(:conference) { create :conference, slug: slug, registrations_enabled: registrations_enabled, organization: organization }
+describe "Visit a conference" do
+ let(:organization) { create(:organization) }
+ let(:conference) { create(:conference, slug:, registrations_enabled:, organization:) }
let(:registrations_enabled) { true }
let(:slug) { "my-conference" }
let(:conference_env) { "CONFERENCE_#{slug.gsub("-", "_").upcase}_REGISTRATION" }
@@ -79,11 +79,11 @@
end
context "when conference program show" do
- let(:organization) { create :organization, time_zone: "UTC" }
+ let(:organization) { create(:organization, time_zone: "UTC") }
let!(:component) { create(:component, manifest_name: :meetings, participatory_space: conference) }
- let!(:conference_speakers) { create_list(:conference_speaker, 3, :with_meeting, conference: conference, meetings_component: component) }
- let(:meetings) { Decidim::ConferenceMeeting.where(component: component) }
- let!(:user) { create(:user, :confirmed, organization: organization, time_zone: timezone) }
+ let!(:conference_speakers) { create_list(:conference_speaker, 3, :with_meeting, conference:, meetings_component: component) }
+ let(:meetings) { Decidim::ConferenceMeeting.where(component:) }
+ let!(:user) { create(:user, :confirmed, organization:, time_zone: timezone) }
let(:timezone) { "CET" }
context "when the user is logged in" do
diff --git a/spec/system/custom_buttons_spec.rb b/spec/system/custom_buttons_spec.rb
index af10f6c8..7301aabc 100644
--- a/spec/system/custom_buttons_spec.rb
+++ b/spec/system/custom_buttons_spec.rb
@@ -2,9 +2,9 @@
require "rails_helper"
-describe "Custom buttons", type: :system do
- let(:organization) { create :organization }
- let(:space) { create :assembly, organization: organization }
+describe "Custom buttons" do
+ let(:organization) { create(:organization) }
+ let(:space) { create(:assembly, organization:) }
let(:space_path) { decidim_assemblies.assembly_path(space) }
let(:env) { :chat_button }
let(:url) { "http://example.org" }
@@ -66,7 +66,7 @@
it_behaves_like "handles the donate button"
context "when participatory_process" do
- let(:space) { create :participatory_process, organization: organization }
+ let(:space) { create(:participatory_process, organization:) }
let(:space_path) { decidim_participatory_processes.participatory_process_path(space) }
it_behaves_like "handles the chat button"
@@ -74,7 +74,7 @@
end
context "when conference" do
- let(:space) { create :conference, organization: organization }
+ let(:space) { create(:conference, organization:) }
let(:space_path) { decidim_conferences.conference_path(space) }
it_behaves_like "handles the chat button"
diff --git a/spec/system/limit_amendments_spec.rb b/spec/system/limit_amendments_spec.rb
index 3c59a670..c7a0e63b 100644
--- a/spec/system/limit_amendments_spec.rb
+++ b/spec/system/limit_amendments_spec.rb
@@ -2,29 +2,29 @@
require "rails_helper"
-describe "Custom proposals fields", type: :system, versioning: true do
- let(:organization) { create :organization, enable_machine_translations: true, machine_translation_display_priority: "translation" }
+describe "Custom proposals fields", versioning: true do
+ let(:organization) { create(:organization, enable_machine_translations: true, machine_translation_display_priority: "translation") }
let(:participatory_process) do
- create(:participatory_process, :with_steps, organization: organization)
+ create(:participatory_process, :with_steps, organization:)
end
let(:component) do
create(:proposal_component,
- participatory_space: participatory_process, settings: settings, step_settings: step_settings)
+ participatory_space: participatory_process, settings:, step_settings:)
end
let(:active_step_id) { participatory_process.active_step.id }
- let(:step_settings) { { active_step_id => { amendment_creation_enabled: amendment_creation_enabled, amendments_visibility: visibility } } }
+ let(:step_settings) { { active_step_id => { amendment_creation_enabled:, amendments_visibility: visibility } } }
let(:visibility) { "all" }
- let(:settings) { { amendments_enabled: amendments_enabled, limit_pending_amendments: limit_pending_amendments } }
- let(:creator) { create(:user, :confirmed, organization: organization) }
- let(:user) { create(:user, :confirmed, organization: organization) }
- let(:amender) { create(:user, :confirmed, organization: organization) }
- let(:follower) { create(:user, :confirmed, organization: organization) }
- let!(:follow) { create :follow, user: follower, followable: proposal }
+ let(:settings) { { amendments_enabled:, limit_pending_amendments: } }
+ let(:creator) { create(:user, :confirmed, organization:) }
+ let(:user) { create(:user, :confirmed, organization:) }
+ let(:amender) { create(:user, :confirmed, organization:) }
+ let(:follower) { create(:user, :confirmed, organization:) }
+ let!(:follow) { create(:follow, user: follower, followable: proposal) }
- let!(:proposal) { create :proposal, users: [creator], component: component }
- let!(:emendation) { create(:proposal, users: [amender], title: { en: "An emendation for the proposal" }, component: component) }
- let!(:amendment) { create(:amendment, amendable: proposal, emendation: emendation, state: amendment_state) }
+ let!(:proposal) { create(:proposal, users: [creator], component:) }
+ let!(:emendation) { create(:proposal, users: [amender], title: { en: "An emendation for the proposal" }, component:) }
+ let!(:amendment) { create(:amendment, amendable: proposal, emendation:, state: amendment_state) }
let(:amendment_state) { "evaluating" }
let(:limit_pending_amendments) { true }
@@ -121,7 +121,7 @@ def amendment_path
click_link "Amend"
end
- let(:proposal) { create :proposal, users: [creator], component: component, title: { fr: "Proposition en langue française", machine_translations: { en: "Proposal in french language" } } }
+ let(:proposal) { create(:proposal, users: [creator], component:, title: { fr: "Proposition en langue française", machine_translations: { en: "Proposal in french language" } }) }
it "Enforces the original locale" do
expect(page).to have_content("This proposal was originally created in Français")
@@ -144,7 +144,7 @@ def amendment_path
end
context "and user has as preference the translated locale" do
- let(:user) { create(:user, :confirmed, organization: organization, locale: "en") }
+ let(:user) { create(:user, :confirmed, organization:, locale: "en") }
it "Enforces the original locale" do
expect(page).to have_content("This proposal was originally created in Français")
@@ -157,8 +157,8 @@ def amendment_path
end
context "when proposal original locale is the organization locale" do
- let(:creator) { create(:user, :confirmed, organization: organization, locale: "fr") }
- let(:proposal) { create :proposal, users: [creator], component: component, title: { en: "Proposal in english language", machine_translations: { fr: "Proposition en langue anglaise" } } }
+ let(:creator) { create(:user, :confirmed, organization:, locale: "fr") }
+ let(:proposal) { create(:proposal, users: [creator], component:, title: { en: "Proposal in english language", machine_translations: { fr: "Proposition en langue anglaise" } }) }
let(:amendment) { nil }
let(:emendation) { nil }
@@ -183,7 +183,7 @@ def amendment_path
end
context "and is an official proposal" do
- let(:proposal) { create :proposal, :official, users: [creator], component: component, title: { en: "Proposal in english language", machine_translations: { fr: "Proposition en langue anglaise" } } }
+ let(:proposal) { create(:proposal, :official, users: [creator], component:, title: { en: "Proposal in english language", machine_translations: { fr: "Proposition en langue anglaise" } }) }
it "Does not enforce the original locale" do
expect(page).not_to have_content("Cette proposition a été initialement créée dans English")
@@ -210,7 +210,7 @@ def amendment_path
end
context "and user has as preference the translated locale" do
- let(:user) { create(:user, :confirmed, organization: organization, locale: "fr") }
+ let(:user) { create(:user, :confirmed, organization:, locale: "fr") }
it "Enforces the original locale" do
expect(page).to have_content("Cette proposition a été initialement créée dans English")
diff --git a/spec/system/site_spec.rb b/spec/system/site_spec.rb
index fd37bd94..34805c03 100644
--- a/spec/system/site_spec.rb
+++ b/spec/system/site_spec.rb
@@ -2,18 +2,18 @@
require "rails_helper"
-describe "Visit the home page", versioning: true, type: :system, perform_enqueued: true do
+describe "Visit the home page", perform_enqueued: true, versioning: true do
include_context "with a component"
- let(:organization) { create :organization }
- let(:process) { create :participatory_process, show_statistics: false, organization: organization }
+ let(:organization) { create(:organization) }
+ let(:process) { create(:participatory_process, show_statistics: false, organization:) }
let!(:component) { create(:proposal_component, participatory_space: process) }
let!(:component2) { create(:meeting_component, participatory_space: process) }
- let!(:proposal) { create(:proposal, title: { en: "Original long enough title" }, body: { en: "Original one liner body" }, component: component) }
+ let!(:proposal) { create(:proposal, title: { en: "Original long enough title" }, body: { en: "Original one liner body" }, component:) }
let!(:meeting) { create(:meeting, :published, title: { en: "Boring long enough title" }, description: { en: "Boring one liner body" }, component: component2) }
# The first version of the emendation should hold the original proposal attribute values being amended.
- let!(:emendation) { create(:proposal, title: proposal.title, body: proposal.body, component: component) }
- let!(:amendment) { create :amendment, amendable: proposal, emendation: emendation }
+ let!(:emendation) { create(:proposal, title: proposal.title, body: proposal.body, component:) }
+ let!(:amendment) { create(:amendment, amendable: proposal, emendation:) }
let(:emendation_path) { Decidim::ResourceLocatorPresenter.new(emendation).path }
let(:proposal_path) { Decidim::ResourceLocatorPresenter.new(proposal).path }
@@ -77,9 +77,9 @@
end
describe "comments sorting" do
- let(:author) { create(:user, :confirmed, organization: organization) }
- let(:comments) { create_list(:comment, 3, commentable: commentable) }
- let(:commentable) { create(:proposal, component: component, users: [author]) }
+ let(:author) { create(:user, :confirmed, organization:) }
+ let(:comments) { create_list(:comment, 3, commentable:) }
+ let(:commentable) { create(:proposal, component:, users: [author]) }
before do
visit resource_locator(commentable).path