Skip to content

Commit

Permalink
fix: Allow to configure deface (#30)
Browse files Browse the repository at this point in the history
* fix: Add arm-darwin-22 support in Gemfile.lock

* fix: Add config_accessor in custom proposal states

* lint: Remove unused requirement

* fix: Deactivate Deface by default

* fix: Enable DEFACE by default for test env
  • Loading branch information
Quentinchampenois authored Feb 19, 2024
1 parent f925b4f commit b18a5f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ GEM
net-smtp (0.4.0)
net-protocol
nio4r (2.7.0)
nokogiri (1.14.5-arm64-darwin)
racc (~> 1.4)
nokogiri (1.14.5-x86_64-linux)
racc (~> 1.4)
oauth (1.1.0)
Expand Down Expand Up @@ -852,6 +854,7 @@ GEM
zeitwerk (2.6.12)

PLATFORMS
arm64-darwin-22
x86_64-linux

DEPENDENCIES
Expand Down
6 changes: 6 additions & 0 deletions lib/decidim/custom_proposal_states.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module Decidim
# This namespace holds the logic of the `CustomProposalStates` component. This component
# allows users to create custom_proposal_states in a participatory space.
module CustomProposalStates
include ActiveSupport::Configurable

module Overrides
autoload :Proposal, "decidim/custom_proposal_states/overrides/proposal"
autoload :ImportProposalsToBudgets, "decidim/custom_proposal_states/overrides/import_proposals_to_budgets"
Expand All @@ -28,6 +30,10 @@ module Overrides
autoload :ProposalSearch, "decidim/custom_proposal_states/overrides/proposal_search"
end

config_accessor :deface_enabled do
ENV.fetch("DEFACE_ENABLED", nil) == "true" || Rails.env.test?
end

def self.module_installed?(mod)
return Decidim.module_installed?(mod) if Decidim.respond_to?(:module_installed?)

Expand Down
2 changes: 1 addition & 1 deletion lib/decidim/custom_proposal_states/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Engine < ::Rails::Engine

initializer "decidim_custom_proposal_states.views" do
Rails.application.configure do
config.deface.enabled = true
config.deface.enabled = Decidim::CustomProposalStates.deface_enabled
end
end

Expand Down

0 comments on commit b18a5f2

Please sign in to comment.