From b6aa45aec75a2bfef82c3cc28cafe7d8bc370f4a Mon Sep 17 00:00:00 2001 From: Quentin Champenois <26109239+Quentinchampenois@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:44:49 +0100 Subject: [PATCH] fix: Decidim awesome slowness on proposals index page (#123) * fix: Deactivate vote_weigth in decidim awesome * fix: enhance logs in dev mode * fix: Allow to configure feat using env var --- .env-example | 4 +++- Gemfile | 2 +- Gemfile.lock | 22 +++++++++++----------- config/environments/development.rb | 1 + config/initializers/decidim_awesome.rb | 5 +++++ config/secrets.yml | 2 ++ 6 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 config/initializers/decidim_awesome.rb diff --git a/.env-example b/.env-example index d4139515..f9aad2e4 100644 --- a/.env-example +++ b/.env-example @@ -19,4 +19,6 @@ FRIENDLY_SIGNUP_USE_CONFIRMATION_CODES=1 DECIDIM_SESSION_TIMEOUT= # SKIP_FIRST_LOGIN_AUTHORIZATION=true -# RAILS_LOG_LEVEL=warn \ No newline at end of file +# RAILS_LOG_LEVEL=warn + +# DECIDIM_AWESOME_WEIGHTED_PROPOSAL_VOTING_ENABLED=disabled # or enabled \ No newline at end of file diff --git a/Gemfile b/Gemfile index 123bca7f..b9ede83e 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem "decidim-budgets_paper_ballots", git: "https://github.com/digidemlab/decidim gem "decidim-cache_cleaner" gem "decidim-custom_proposal_states", git: "https://github.com/alecslupu-pfa/decidim-module-custom_proposal_states", branch: DECIDIM_BRANCH -gem "decidim-decidim_awesome", git: "https://github.com/Quentinchampenois/decidim-module-decidim_awesome", branch: "rc/0.27-without-vote-weighted" +gem "decidim-decidim_awesome", git: "https://github.com/decidim-ice/decidim-module-decidim_awesome", branch: DECIDIM_BRANCH gem "decidim-extra_user_fields", git: "https://github.com/OpenSourcePolitics/decidim-module-extra_user_fields.git", branch: DECIDIM_BRANCH gem "decidim-friendly_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-friendly_signup.git" gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH diff --git a/Gemfile.lock b/Gemfile.lock index 651a28ef..4a991f5e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,17 +67,6 @@ GIT omniauth (~> 2.0) omniauth-oauth2 (>= 1.7.2, < 2.0) -GIT - remote: https://github.com/Quentinchampenois/decidim-module-decidim_awesome - revision: 03a5b90f038d0662d61dc25ef3acf7692eb3dd87 - branch: rc/0.27-without-vote-weighted - specs: - decidim-decidim_awesome (0.10.3) - decidim-admin (>= 0.26.0, < 0.28) - decidim-core (>= 0.26.0, < 0.28) - deface (>= 1.5) - sassc (~> 2.3) - GIT remote: https://github.com/alecslupu-pfa/decidim-module-custom_proposal_states revision: 848eb550d44d9bebc9e72c458c4e3aab79203d9e @@ -88,6 +77,17 @@ GIT decidim-proposals (~> 0.27) deface (>= 1.9) +GIT + remote: https://github.com/decidim-ice/decidim-module-decidim_awesome + revision: c72e7f0fa0fe98807ace8414ecc08cbf44ce72d5 + branch: release/0.27-stable + specs: + decidim-decidim_awesome (0.10.4) + decidim-admin (>= 0.26.0, < 0.28) + decidim-core (>= 0.26.0, < 0.28) + deface (>= 1.5) + sassc (~> 2.3) + GIT remote: https://github.com/digidemlab/decidim-module-budgets_paper_ballots revision: 750d20ecc670859df85393c01a72902e20509562 diff --git a/config/environments/development.rb b/config/environments/development.rb index 083f36ce..72d3676e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -58,4 +58,5 @@ config.active_job.queue_adapter = :sidekiq config.action_mailer.perform_deliveries = true config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "debug").to_sym + config.log_tags = [:uuid, :remote_ip] end diff --git a/config/initializers/decidim_awesome.rb b/config/initializers/decidim_awesome.rb new file mode 100644 index 00000000..24a30cdb --- /dev/null +++ b/config/initializers/decidim_awesome.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +Decidim::DecidimAwesome.configure do |config| + config.weighted_proposal_voting = Rails.application.secrets.dig(:decidim, :decidim_awesome, :weighted_proposal_voting_enabled)&.to_sym +end diff --git a/config/secrets.yml b/config/secrets.yml index c1026ced..d9c4a3a0 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -13,6 +13,8 @@ default: &default asset_host: <%= ENV["ASSET_HOST"] %> decidim: + decidim_awesome: + weighted_proposal_voting_enabled: <%= ENV.fetch("DECIDIM_AWESOME_WEIGHTED_PROPOSAL_VOTING_ENABLED", "disabled") %> currency: <%= ENV["CURRENCY"] || "€" %> rack_attack: enabled: <%= ENV["ENABLE_RACK_ATTACK"] %>